!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(u){"use strict";u.ui=u.ui||{},u.ui.version="1.13.1";var a=u,n={},e=n.toString,f=/^([\-+])=\s*(\d+\.?\d*)/,t=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=a.Color=function(t,e,n,r){return new a.Color.fn.parse(t,e,n,r)},d={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},p={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},s=l.support={},r=a("
")[0],h=a.each;
function g(t){return null==t?t+"":"object"==typeof t?n[e.call(t)]||"object":typeof t}function m(t,e,n){var r=p[e.type]||{};return null==t?n||!e.def?null:e.def:(t=r.floor?~~t:parseFloat(t),isNaN(t)?e.def:r.mod?(t+r.mod)%r.mod:Math.min(r.max,Math.max(0,t)))}function c(r){var o=l(),i=o._rgba=[];return r=r.toLowerCase(),h(t,function(t,e){var n=e.re.exec(r),n=n&&e.parse(n),e=e.space||"rgba";if(n)return n=o[e](n),o[d[e].cache]=n[d[e].cache],i=o._rgba=n._rgba,!1}),i.length?("0,0,0,0"===i.join()&&a.extend(i,M.transparent),o):M[r]}function o(t,e,n){return 6*(n=(n+1)%1)<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}r.style.cssText="background-color:rgba(1,1,1,.5)",s.rgba=-1i.mod/2?r+=i.mod:r-o>i.mod/2&&(r-=i.mod)),c[n]=m((o-r)*s+r,e)))}),this[t](c)},blend:function(t){var e,n,r;return 1===this._rgba[3]?this:(e=this._rgba.slice(),n=e.pop(),r=l(t)._rgba,l(a.map(e,function(t,e){return(1-n)*r[e]+n*t})))},toRgbaString:function(){var t="rgba(",e=a.map(this._rgba,function(t,e){return null!=t?t:2").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:n.width(),height:n.height()},o=document.activeElement;try{o.id}catch(t){o=document.body}return n.wrap(t),n[0]!==o&&!u.contains(n[0],o)||u(o).trigger("focus"),t=n.parent(),"static"===n.css("position")?(t.css({position:"relative"}),n.css({position:"relative"})):(u.extend(r,{position:n.css("position"),zIndex:n.css("z-index")}),u.each(["top","left","bottom","right"],function(t,e){r[e]=n.css(e),isNaN(parseInt(r[e],10))&&(r[e]="auto")}),n.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),n.css(e),t.css(r).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!u.contains(t[0],e)||u(e).trigger("focus")),t}}),u.extend(u.effects,{version:"1.13.2",define:function(t,e,n){return n||(n=e,e="effect"),u.effects.effect[t]=n,u.effects.effect[t].mode=e,n},scaledDimensions:function(t,e,n){var r;return 0===e?{height:0,width:0,outerHeight:0,outerWidth:0}:(r="horizontal"!==n?(e||100)/100:1,n="vertical"!==n?(e||100)/100:1,{height:t.height()*n,width:t.width()*r,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*r})},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,n){var r=t.queue();1").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:n,left:r.left,top:r.top}),e},removePlaceholder:function(t){var e=j+"placeholder",n=t.data(e);n&&(n.remove(),t.removeData(e))},cleanUp:function(t){u.effects.restoreStyle(t),u.effects.removePlaceholder(t)},setTransition:function(r,t,o,i){return i=i||{},u.each(t,function(t,e){var n=r.cssUnit(e);0");c.appendTo("body").addClass(t.className).css({top:r.top-s,left:r.left-i,height:n.innerHeight(),width:n.innerWidth(),position:o?"fixed":"absolute"}).animate(a,t.duration,t.easing,function(){c.remove(),"function"==typeof e&&e()})}}),u.fx.step.clip=function(t){t.clipInit||(t.start=u(t.elem).cssClip(),"string"==typeof t.end&&(t.end=R(t.end,t.elem)),t.clipInit=!0),u(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},S={},u.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){S[t]=function(t){return Math.pow(t,e+2)}}),u.extend(S,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)}}),u.each(S,function(t,e){u.easing["easeIn"+t]=e,u.easing["easeOut"+t]=function(t){return 1-e(1-t)},u.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}}),u.effects});
(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"Warning: No message defined for "+e.name+"")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
(function($){
if($.fn.validate){
$.extend($.datepicker.regional[''], {
validateDate: 'Please enter a valid date',
validateDateMin: 'Please enter a date on or after {0}',
validateDateMax: 'Please enter a date on or before {0}',
validateDateMinMax: 'Please enter a date between {0} and {1}',
validateDateCompare: 'Please enter a date {0} {1}'
});
$.extend($.datepicker._defaults, $.datepicker.regional['']);
$.extend($.datepicker, {
errorFormat: function(inst, message, params){
var format=$.datepicker._get(inst, 'dateFormat');
$.each(params, function(i, v){
if(message){
message=message.replace(new RegExp('\\{' + i + '\\}', 'g'),
$.datepicker.formatDate(format, v)||'nothing');
}});
return message;
}});
jQuery.validator.addMethod("dateFormatDate", function(value, element, params){
lastElement=element;
var inst=$.datepicker._getInst(element);
try {
var date=$.datepicker.parseDate(window.datepickerDateFormat, value, $.datepicker._getFormatConfig(inst));
var minDate=$.datepicker._determineDate(inst, $.datepicker._get(inst, 'minDate'), null);
var maxDate=$.datepicker._determineDate(inst, $.datepicker._get(inst, 'maxDate'), null);
var beforeShowDay=$.datepicker._get(inst, 'beforeShowDay');
return this.optional(element)||!date ||
((!minDate||date >=minDate)&&(!maxDate||date <=maxDate) &&
(!beforeShowDay||beforeShowDay.apply(element, [date])[0]));
}
catch (e){
return false;
}}, function(params){
var inst=$.datepicker._getInst(lastElement);
var minDate=$.datepicker._determineDate(inst, $.datepicker._get(inst, 'minDate'), null);
var maxDate=$.datepicker._determineDate(inst, $.datepicker._get(inst, 'maxDate'), null);
var messages=$.datepicker._defaults;
return (minDate&&maxDate ?
$.datepicker.errorFormat(inst, messages.validateDateMinMax, [minDate, maxDate]) :
(minDate ? $.datepicker.errorFormat(inst, messages.validateDateMin, [minDate]) :
(maxDate ? $.datepicker.errorFormat(inst, messages.validateDateMax, [maxDate]) :
messages.validateDate)));
});
$.validator.addClassRules('dateFormatDate', {dateFormatDate: true});
}})(jQuery);
!function(e){function t(){var e=location.href;return hashtag=-1!==e.indexOf("#prettyPhoto")?decodeURI(e.substring(e.indexOf("#prettyPhoto")+1,e.length)):!1,hashtag&&(hashtag=hashtag.replace(/<|>/g,"")),hashtag}function i(){"undefined"!=typeof theRel&&(location.hash=theRel+"/"+rel_index+"/")}function p(){-1!==location.href.indexOf("#prettyPhoto")&&(location.hash="prettyPhoto")}function o(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i="[\\?&]"+e+"=([^]*)",p=new RegExp(i),o=p.exec(t);return null==o?"":o[1]}e.prettyPhoto={version:"3.1.6"},e.fn.prettyPhoto=function(a){function s(){e(".pp_loaderIcon").hide(),projectedTop=scroll_pos.scrollTop+(I/2-f.containerHeight/2),projectedTop<0&&(projectedTop=0),$ppt.fadeTo(settings.animation_speed,1),$pp_pic_holder.find(".pp_content").animate({height:f.contentHeight,width:f.contentWidth},settings.animation_speed),$pp_pic_holder.animate({top:projectedTop,left:j/2-f.containerWidth/2<0?0:j/2-f.containerWidth/2,width:f.containerWidth},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(f.height).width(f.width),$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed),isSet&&"image"==h(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide(),settings.allow_expand&&(f.resized?e("a.pp_expand,a.pp_contract").show():e("a.pp_expand").hide()),!settings.autoplay_slideshow||P||v||e.prettyPhoto.startSlideshow(),settings.changepicturecallback(),v=!0}),m(),a.ajaxcallback()}function n(t){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden"),$pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed,function(){e(".pp_loaderIcon").show(),t()})}function r(t){t>1?e(".pp_nav").show():e(".pp_nav").hide()}function l(e,t){if(resized=!1,d(e,t),imageWidth=e,imageHeight=t,(k>j||b>I)&&doresize&&settings.allow_resize&&!$){for(resized=!0,fitting=!1;!fitting;)k>j?(imageWidth=j-200,imageHeight=t/e*imageWidth):b>I?(imageHeight=I-200,imageWidth=e/t*imageHeight):fitting=!0,b=imageHeight,k=imageWidth;(k>j||b>I)&&l(k,b),d(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(b),containerWidth:Math.floor(k)+2*settings.horizontal_padding,contentHeight:Math.floor(y),contentWidth:Math.floor(w),resized:resized}}function d(t,i){t=parseFloat(t),i=parseFloat(i),$pp_details=$pp_pic_holder.find(".pp_details"),$pp_details.width(t),detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom")),$pp_details=$pp_details.clone().addClass(settings.theme).width(t).appendTo(e("body")).css({position:"absolute",top:-1e4}),detailsHeight+=$pp_details.height(),detailsHeight=detailsHeight<=34?36:detailsHeight,$pp_details.remove(),$pp_title=$pp_pic_holder.find(".ppt"),$pp_title.width(t),titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom")),$pp_title=$pp_title.clone().appendTo(e("body")).css({position:"absolute",top:-1e4}),titleHeight+=$pp_title.height(),$pp_title.remove(),y=i+detailsHeight,w=t,b=y+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height(),k=t}function h(e){return e.match(/youtube\.com\/watch/i)||e.match(/youtu\.be/i)?"youtube":e.match(/vimeo\.com/i)?"vimeo":e.match(/\b.mov\b/i)?"quicktime":e.match(/\b.swf\b/i)?"flash":e.match(/\biframe=true\b/i)?"iframe":e.match(/\bajax=true\b/i)?"ajax":e.match(/\bcustom=true\b/i)?"custom":"#"==e.substr(0,1)?"inline":"image"}function c(){if(doresize&&"undefined"!=typeof $pp_pic_holder){if(scroll_pos=_(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=I/2+scroll_pos.scrollTop-contentHeight/2,projectedTop<0&&(projectedTop=0),contentHeight>I)return;$pp_pic_holder.css({top:projectedTop,left:j/2+scroll_pos.scrollLeft-contentwidth/2})}}function _(){return self.pageYOffset?{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}:document.documentElement&&document.documentElement.scrollTop?{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}:document.body?{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}:void 0}function g(){I=e(window).height(),j=e(window).width(),"undefined"!=typeof $pp_overlay&&$pp_overlay.height(e(document).height()).width(j)}function m(){isSet&&settings.overlay_gallery&&"image"==h(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==settings.theme||"pp_default"==settings.theme?50:30,itemsPerPage=Math.floor((f.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage";toInject=settings.gallery_markup.replace(/{gallery}/g,toInject),$pp_pic_holder.find("#pp_full_res").after(toInject),$pp_gallery=e(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li"),$pp_gallery.find(".pp_arrow_next").click(function(){return e.prettyPhoto.changeGalleryPage("next"),e.prettyPhoto.stopSlideshow(),!1}),$pp_gallery.find(".pp_arrow_previous").click(function(){return e.prettyPhoto.changeGalleryPage("previous"),e.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()}),itemWidth=57,$pp_gallery_li.each(function(t){e(this).find("a").click(function(){return e.prettyPhoto.changePage(t),e.prettyPhoto.stopSlideshow(),!1})})}settings.slideshow&&($pp_pic_holder.find(".pp_nav").prepend('Play'),$pp_pic_holder.find(".pp_nav .pp_play").click(function(){return e.prettyPhoto.startSlideshow(),!1})),$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme),$pp_overlay.css({opacity:0,height:e(document).height(),width:e(window).width()}).bind("click",function(){settings.modal||e.prettyPhoto.close()}),e("a.pp_close").bind("click",function(){return e.prettyPhoto.close(),!1}),settings.allow_expand&&e("a.pp_expand").bind("click",function(){return e(this).hasClass("pp_expand")?(e(this).removeClass("pp_expand").addClass("pp_contract"),doresize=!1):(e(this).removeClass("pp_contract").addClass("pp_expand"),doresize=!0),n(function(){e.prettyPhoto.open()}),!1}),$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){return e.prettyPhoto.changePage("previous"),e.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){return e.prettyPhoto.changePage("next"),e.prettyPhoto.stopSlideshow(),!1}),c()}a=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:!1,opacity:.8,show_title:!0,allow_resize:!0,allow_expand:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,deeplinking:!0,overlay_gallery:!0,overlay_gallery_max:30,keyboard_shortcuts:!0,changepicturecallback:function(){},callback:function(){},ie6_fallback:!0,markup:' ',gallery_markup:'',image_markup:'',flash_markup:'',quicktime_markup:'',iframe_markup:'',inline_markup:'{content}
',custom_markup:"",social_tools:''},a);var f,v,y,w,b,k,P,x=this,$=!1,I=e(window).height(),j=e(window).width();return doresize=!0,scroll_pos=_(),e(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){c(),g()}),a.keyboard_shortcuts&&e(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(t){if("undefined"!=typeof $pp_pic_holder&&$pp_pic_holder.is(":visible"))switch(t.keyCode){case 37:e.prettyPhoto.changePage("previous"),t.preventDefault();break;case 39:e.prettyPhoto.changePage("next"),t.preventDefault();break;case 27:settings.modal||e.prettyPhoto.close(),t.preventDefault()}}),e.prettyPhoto.initialize=function(){return settings=a,"pp_default"==settings.theme&&(settings.horizontal_padding=16),theRel=e(this).attr(settings.hook),galleryRegExp=/\[(?:.*)\]/,isSet=galleryRegExp.exec(theRel)?!0:!1,pp_images=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).attr("href"):void 0}):e.makeArray(e(this).attr("href")),pp_titles=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).find("img").attr("alt")?e(t).find("img").attr("alt"):"":void 0}):e.makeArray(e(this).find("img").attr("alt")),pp_descriptions=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).attr("title")?e(t).attr("title"):"":void 0}):e.makeArray(e(this).attr("title")),pp_images.length>settings.overlay_gallery_max&&(settings.overlay_gallery=!1),set_position=jQuery.inArray(e(this).attr("href"),pp_images),rel_index=isSet?set_position:e("a["+settings.hook+"^='"+theRel+"']").index(e(this)),u(this),settings.allow_resize&&e(window).bind("scroll.prettyphoto",function(){c()}),e.prettyPhoto.open(),!1},e.prettyPhoto.open=function(t){return"undefined"==typeof settings&&(settings=a,pp_images=e.makeArray(arguments[0]),pp_titles=e.makeArray(arguments[1]?arguments[1]:""),pp_descriptions=e.makeArray(arguments[2]?arguments[2]:""),isSet=pp_images.length>1?!0:!1,set_position=arguments[3]?arguments[3]:0,u(t.target)),settings.hideflash&&e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden"),r(e(pp_images).size()),e(".pp_loaderIcon").show(),settings.deeplinking&&i(),settings.social_tools&&(facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href)),$pp_pic_holder.find(".pp_social").html(facebook_like_link)),$ppt.is(":hidden")&&$ppt.css("opacity",0).show(),$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity),$pp_pic_holder.find(".currentTextHolder").text(set_position+1+settings.counter_separator_label+e(pp_images).size()),"undefined"!=typeof pp_descriptions[set_position]&&""!=pp_descriptions[set_position]?$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position])):$pp_pic_holder.find(".pp_description").hide(),movie_width=parseFloat(o("width",pp_images[set_position]))?o("width",pp_images[set_position]):settings.default_width.toString(),movie_height=parseFloat(o("height",pp_images[set_position]))?o("height",pp_images[set_position]):settings.default_height.toString(),$=!1,-1!=movie_height.indexOf("%")&&(movie_height=parseFloat(e(window).height()*parseFloat(movie_height)/100-150),$=!0),-1!=movie_width.indexOf("%")&&(movie_width=parseFloat(e(window).width()*parseFloat(movie_width)/100-150),$=!0),$pp_pic_holder.fadeIn(function(){switch($ppt.html(settings.show_title&&""!=pp_titles[set_position]&&"undefined"!=typeof pp_titles[set_position]?unescape(pp_titles[set_position]):" "),imgPreloader="",skipInjection=!1,h(pp_images[set_position])){case"image":imgPreloader=new Image,nextImage=new Image,isSet&&set_position0&&(movie_id=movie_id.substr(0,movie_id.indexOf("?"))),movie_id.indexOf("&")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("&")))),movie="http://www.youtube.com/embed/"+movie_id,movie+=o("rel",pp_images[set_position])?"?rel="+o("rel",pp_images[set_position]):"?rel=1",settings.autoplay&&(movie+="&autoplay=1"),toInject=settings.iframe_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":f=l(movie_width,movie_height),movie_id=pp_images[set_position];var t=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/,i=movie_id.match(t);movie="http://player.vimeo.com/video/"+i[3]+"?title=0&byline=0&portrait=0",settings.autoplay&&(movie+="&autoplay=1;"),vimeo_width=f.width+"/embed/?moog_width="+f.width,toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,f.height).replace(/{path}/g,movie);break;case"quicktime":f=l(movie_width,movie_height),f.height+=15,f.contentHeight+=15,f.containerHeight+=15,toInject=settings.quicktime_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":f=l(movie_width,movie_height),flash_vars=pp_images[set_position],flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+10,pp_images[set_position].length),filename=pp_images[set_position],filename=filename.substring(0,filename.indexOf("?")),toInject=settings.flash_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":f=l(movie_width,movie_height),frame_url=pp_images[set_position],frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1),toInject=settings.iframe_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{path}/g,frame_url);break;case"ajax":doresize=!1,f=l(movie_width,movie_height),doresize=!0,skipInjection=!0,e.get(pp_images[set_position],function(e){toInject=settings.inline_markup.replace(/{content}/g,e),$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,s()});break;case"custom":f=l(movie_width,movie_height),toInject=settings.custom_markup;break;case"inline":myClone=e(pp_images[set_position]).clone().append('
').css({width:settings.default_width}).wrapInner('').appendTo(e("body")).show(),doresize=!1,f=l(e(myClone).width(),e(myClone).height()),doresize=!0,e(myClone).remove(),toInject=settings.inline_markup.replace(/{content}/g,e(pp_images[set_position]).html())}imgPreloader||skipInjection||($pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,s())}),!1},e.prettyPhoto.changePage=function(t){currentGalleryPage=0,"previous"==t?(set_position--,set_position<0&&(set_position=e(pp_images).size()-1)):"next"==t?(set_position++,set_position>e(pp_images).size()-1&&(set_position=0)):set_position=t,rel_index=set_position,doresize||(doresize=!0),settings.allow_expand&&e(".pp_contract").removeClass("pp_contract").addClass("pp_expand"),n(function(){e.prettyPhoto.open()})},e.prettyPhoto.changeGalleryPage=function(e){"next"==e?(currentGalleryPage++,currentGalleryPage>totalPage&&(currentGalleryPage=0)):"previous"==e?(currentGalleryPage--,currentGalleryPage<0&&(currentGalleryPage=totalPage)):currentGalleryPage=e,slide_speed="next"==e||"previous"==e?settings.animation_speed:0,slide_to=currentGalleryPage*itemsPerPage*itemWidth,$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)},e.prettyPhoto.startSlideshow=function(){"undefined"==typeof P?($pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){return e.prettyPhoto.stopSlideshow(),!1}),P=setInterval(e.prettyPhoto.startSlideshow,settings.slideshow)):e.prettyPhoto.changePage("next")},e.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){return e.prettyPhoto.startSlideshow(),!1}),clearInterval(P),P=void 0},e.prettyPhoto.close=function(){$pp_overlay.is(":animated")||(e.prettyPhoto.stopSlideshow(),$pp_pic_holder.stop().find("object,embed").css("visibility","hidden"),e("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){e(this).remove()}),$pp_overlay.fadeOut(settings.animation_speed,function(){settings.hideflash&&e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible"),e(this).remove(),e(window).unbind("scroll.prettyphoto"),p(),settings.callback(),doresize=!0,v=!1,delete settings}))},!pp_alreadyInitialized&&t()&&(pp_alreadyInitialized=!0,hashIndex=t(),hashRel=hashIndex,hashIndex=hashIndex.substring(hashIndex.indexOf("/")+1,hashIndex.length-1),hashRel=hashRel.substring(0,hashRel.indexOf("/")),setTimeout(function(){e("a["+a.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)),this.unbind("click.prettyphoto").bind("click.prettyphoto",e.prettyPhoto.initialize)}}(jQuery);var pp_alreadyInitialized=!1;
;(function(b){var a={init:function(c){return this.each(function(){var d=this,h=b(d).empty();d.opt=b.extend(true,{},b.fn.raty.defaults,c);h.data("settings",d.opt);d.opt.number=a.between(d.opt.number,0,20);if(d.opt.path.substring(d.opt.path.length-1,d.opt.path.length)!="/"){d.opt.path+="/";}if(typeof d.opt.score=="function"){d.opt.score=d.opt.score.call(d);}if(d.opt.score){d.opt.score=a.between(d.opt.score,0,d.opt.number);}for(var e=1;e<=d.opt.number;e++){b("",{src:d.opt.path+((!d.opt.score||d.opt.score",{type:"hidden",name:d.opt.scoreName}).appendTo(d);if(d.opt.score&&d.opt.score>0){d.score.val(d.opt.score);a.roundStar.call(d,d.opt.score);}if(d.opt.iconRange){a.fill.call(d,d.opt.score);}a.setTarget.call(d,d.opt.score,d.opt.targetKeep);var g=d.opt.space?4:0,f=d.opt.width||(d.opt.number*d.opt.size+d.opt.number*g);if(d.opt.cancel){d.cancel=b("",{src:d.opt.path+d.opt.cancelOff,alt:"x",title:d.opt.cancelHint,"class":"raty-cancel"});if(d.opt.cancelPlace=="left"){h.prepend(" ").prepend(d.cancel);}else{h.append(" ").append(d.cancel);}f+=(d.opt.size+g);}if(d.opt.readOnly){a.fixHint.call(d);if(d.cancel){d.cancel.hide();}}else{h.css("cursor","pointer");a.bindAction.call(d);}h.css("width",f);});},between:function(e,d,c){return Math.min(Math.max(parseFloat(e),d),c);},bindAction:function(){var c=this,e=b(c);e.mouseleave(function(){var f=c.score.val()||undefined;a.initialize.call(c,f);a.setTarget.call(c,f,c.opt.targetKeep);if(c.opt.mouseover){c.opt.mouseover.call(c,f);}});var d=c.opt.half?"mousemove":"mouseover";if(c.opt.cancel){c.cancel.mouseenter(function(){b(this).attr("src",c.opt.path+c.opt.cancelOn);c.stars.attr("src",c.opt.path+c.opt.starOff);a.setTarget.call(c,null,true);if(c.opt.mouseover){c.opt.mouseover.call(c,null);}}).mouseleave(function(){b(this).attr("src",c.opt.path+c.opt.cancelOff);if(c.opt.mouseover){c.opt.mouseover.call(c,c.score.val()||null);}}).click(function(f){c.score.removeAttr("value");if(c.opt.click){c.opt.click.call(c,null,f);}});}c.stars.bind(d,function(g){var h=parseInt(this.alt,10);if(c.opt.half){var f=parseFloat((g.pageX-b(this).offset().left)/c.opt.size),i=(f>0.5)?1:0.5;h=parseFloat(this.alt)-1+i;a.fill.call(c,h);if(c.opt.precision){h=h-i+f;}a.showHalf.call(c,h);}else{a.fill.call(c,h);}e.data("score",h);a.setTarget.call(c,h,true);if(c.opt.mouseover){c.opt.mouseover.call(c,h,g);}}).click(function(f){c.score.val((c.opt.half||c.opt.precision)?e.data("score"):this.alt);if(c.opt.click){c.opt.click.call(c,c.score.val(),f);}});},cancel:function(c){return b(this).each(function(){var d=this,e=b(d);if(e.data("readonly")===true){return this;}if(c){a.click.call(d,null);}else{a.score.call(d,null);}d.score.removeAttr("value");});},click:function(c){return b(this).each(function(){if(b(this).data("readonly")===true){return this;}a.initialize.call(this,c);if(this.opt.click){this.opt.click.call(this,c);}else{a.error.call(this,'you must add the "click: function(score, evt){ }" callback.');}a.setTarget.call(this,c,true);});},error:function(c){b(this).html(c);b.error(c);},fill:function(k){var c=this,h=c.stars.length,g=0,d,j,f;for(var e=1;e<=h;e++){d=c.stars.eq(e-1);if(c.opt.iconRange&&c.opt.iconRange.length>g){j=c.opt.iconRange[g];if(c.opt.single){f=(e==k)?(j.on||c.opt.starOn):(j.off||c.opt.starOff);}else{f=(e<=k)?(j.on||c.opt.starOn):(j.off||c.opt.starOff);}if(e<=j.range){d.attr("src",c.opt.path+f);}if(e==j.range){g++;}}else{if(c.opt.single){f=(e==k)?c.opt.starOn:c.opt.starOff;}else{f=(e<=k)?c.opt.starOn:c.opt.starOff;}d.attr("src",c.opt.path+f);}}},fixHint:function(){var c=b(this),e=parseInt(this.score.val(),10),d=this.opt.noRatedMsg;if(!isNaN(e)&&e>0){d=(e<=this.opt.hints.length&&this.opt.hints[e-1]!==null)?this.opt.hints[e-1]:e;}c.data("readonly",true).css("cursor","default").attr("title",d);this.score.attr("readonly","readonly");this.stars.attr("title",d);},getScore:function(){var d=[],c;b(this).each(function(){c=this.score.val();d.push(c?parseFloat(c):undefined);});return(d.length>1)?d:d[0];},readOnly:function(c){return this.each(function(){var d=b(this);if(d.data("readonly")===c){return this;}if(this.cancel){if(c){this.cancel.hide();}else{this.cancel.show();}}if(c){d.unbind();d.children("img").unbind();a.fixHint.call(this);}else{a.bindAction.call(this);a.unfixHint.call(this);}d.data("readonly",c);});},reload:function(){return a.set.call(this,{});},roundStar:function(e){var d=(e-Math.floor(e)).toFixed(2);if(d>this.opt.round.down){var c=this.opt.starOn;if(d0&&c<0.6){this.stars.eq(Math.ceil(d)-1).attr("src",this.opt.path+this.opt.starHalf);}},initialize:function(c){c=!c?0:a.between(c,0,this.opt.number);a.fill.call(this,c);if(c>0){if(this.opt.halfShow){a.roundStar.call(this,c);}this.score.val(c);}},unfixHint:function(){for(var c=0;c -1 ?(eminpx||getEmValue()):1);
}
if(!!max){
max=parseFloat(max) *(max.indexOf(em) > -1 ?(eminpx||getEmValue()):1);
}
if(!thisstyle.hasquery||(!minnull||!maxnull)&&(minnull||currWidth >=min)&&(maxnull||currWidth <=max)){
if(!styleBlocks[ thisstyle.media ]){
styleBlocks[ thisstyle.media ]=[];
}
styleBlocks[ thisstyle.media ].push(rules[ thisstyle.rules ]);
}}
}
for(var j in appendedEls){
if(appendedEls.hasOwnProperty(j)){
if(appendedEls[ j ]&&appendedEls[ j ].parentNode===head){
head.removeChild(appendedEls[ j ]);
}}
}
appendedEls.length=0;
for(var k in styleBlocks){
if(styleBlocks.hasOwnProperty(k)){
var ss=doc.createElement("style"),
css=styleBlocks[ k ].join("\n");
ss.type="text/css";
ss.media=k;
head.insertBefore(ss, lastLink.nextSibling);
if(ss.styleSheet){
ss.styleSheet.cssText=css;
}else{
ss.appendChild(doc.createTextNode(css));
}
appendedEls.push(ss);
}}
},
translate=function(styles, href, media){
var qs=styles.replace(respond.regex.comments, '')
.replace(respond.regex.keyframes, '')
.match(respond.regex.media),
ql=qs&&qs.length||0;
href=href.substring(0, href.lastIndexOf("/"));
var repUrls=function(css){
return css.replace(respond.regex.urls, "$1" + href + "$2$3");
},
useMedia = !ql&&media;
if(href.length){ href +="/"; }
if(useMedia){
ql=1;
}
for(var i=0; i < ql; i++){
var fullq, thisq, eachq, eql;
if(useMedia){
fullq=media;
rules.push(repUrls(styles));
}else{
fullq=qs[ i ].match(respond.regex.findStyles)&&RegExp.$1;
rules.push(RegExp.$2&&repUrls(RegExp.$2));
}
eachq=fullq.split(",");
eql=eachq.length;
for(var j=0; j < eql; j++){
thisq=eachq[ j ];
if(isUnsupportedMediaQuery(thisq)){
continue;
}
mediastyles.push({
media:thisq.split("(")[ 0 ].match(respond.regex.only)&&RegExp.$2||"all",
rules:rules.length - 1,
hasquery:thisq.indexOf("(") > -1,
minw:thisq.match(respond.regex.minw)&&parseFloat(RegExp.$1) +(RegExp.$2||""),
maxw:thisq.match(respond.regex.maxw)&&parseFloat(RegExp.$1) +(RegExp.$2||"")
});
}}
applyMedia();
},
makeRequests=function(){
if(requestQueue.length){
var thisRequest=requestQueue.shift();
ajax(thisRequest.href, function(styles){
translate(styles, thisRequest.href, thisRequest.media);
parsedSheets[ thisRequest.href ]=true;
w.setTimeout(function(){ makeRequests(); },0);
});
}},
ripCSS=function(){
for(var i=0; i < links.length; i++){
var sheet=links[ i ],
href=sheet.href,
media=sheet.media,
isCSS=sheet.rel&&sheet.rel.toLowerCase()==="stylesheet";
if(!!href&&isCSS&&!parsedSheets[ href ]){
if(sheet.styleSheet&&sheet.styleSheet.rawCssText){
translate(sheet.styleSheet.rawCssText, href, media);
parsedSheets[ href ]=true;
}else{
if((!/^([a-zA-Z:]*\/\/)/.test(href)&&!base) ||
href.replace(RegExp.$1, "").split("/")[0]===w.location.host){
if(href.substring(0,2)==="//"){ href=w.location.protocol + href; }
requestQueue.push({
href: href,
media: media
});
}}
}}
makeRequests();
};
ripCSS();
respond.update=ripCSS;
respond.getEmValue=getEmValue;
function callMedia(){
applyMedia(true);
}
if(w.addEventListener){
w.addEventListener("resize", callMedia, false);
}
else if(w.attachEvent){
w.attachEvent("onresize", callMedia);
}})(this);
(function($){
$(document).ready(function (){
bookyourtravel_scripts.init();
});
$(window).load(function(){
bookyourtravel_scripts.load();
});
var bookyourtravel_scripts={
init: function (){
$('.toggle_lightbox').on('click', function(e){
var isLoginLightbox=$(this).hasClass('login_lightbox');
var isRegisterLightbox=$(this).hasClass('register_lightbox');
if(!isLoginLightbox&&$('#login_lightbox').is(":visible")){
$('#login_lightbox').hide();
}
else if(!isRegisterLightbox&&$('#register_lightbox').is(":visible")){
$('#register_lightbox').hide();
}
if(isRegisterLightbox){
$('#register_lightbox').toggle(500);
}
if(isLoginLightbox){
$('#login_lightbox').toggle(500);
}});
$("input[type=radio]").uniform();
$("input[type=checkbox]").uniform();
$("select").not(".dynamic_control,.woocommerce select").uniform();
$("input[type=checkbox]").not(".woocommerce-checkout input[type=checkbox]").uniform();
$('.scroll-to-top').click(function (){
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
$('.ribbon .profile-nav li').hide();
$('.ribbon .profile-nav .active').show();
$(".ribbon li a").click(bookyourtravel_scripts.handleRibbonClick);
$("a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'light_square'});
$(".tab-content").hide();
$(".tab-content.initial").show();
var activeIndex=$('.inner-nav li.active').index();
var currentMenuItemIndex=$('.inner-nav li.current-menu-item').index();
if(activeIndex==-1)
$(".inner-nav li:first").addClass("active");
if(currentMenuItemIndex > -1){
$(".inner-nav li").removeClass("active");
}
$(".inner-nav a").click(function(e){
$(".inner-nav li").removeClass("active");
$(this).parent().addClass("active");
var currentTab=$(this).attr("href");
$(".tab-content").hide();
$(currentTab).show();
if(currentTab=="#location"||currentTab=="#map"){
window.InitializeMap();
$mapIframe=$('.gmap iframe');
if(typeof ($mapIframe)!='undefined'&&$mapIframe.length > 0){
$mapIframe.attr('src', $mapIframe.attr('src'));
}}
e.preventDefault();
});
var hash=window.location.hash;
if(hash.length > 0){
var hashbang=hash.replace('#', '');
if(hashbang.length > 0){
var anchor=$('.inner-nav li a[href="#' + hashbang + '"]');
if(anchor.length > 0){
var li=anchor.parent();
if(li.length > 0){
$(".inner-nav li").removeClass('active');
li.addClass('active');
$(".tab-content").hide();
$(".tab-content#" + hashbang).show();
}}
}}
$(".more-information").slideUp();
$(".more-info").click(function(e){
var moreinformation=$(this).closest("li").find(".more-information");
var txt=moreinformation.is(':visible') ? window.moreInfoText:window.lessInfoText;
$(this).text(txt);
moreinformation.stop(true, true).slideToggle("slow");
e.preventDefault();
});
$(".f-item .radio").click(function(e){
$(".f-item").removeClass("active");
$(this).parent().addClass("active");
});
$('.grid-view').click(function(e){
var currentClass=$(".three-fourth article").attr("class");
if(typeof currentClass!='undefined'&¤tClass.length > 0){
currentClass=currentClass.replace('last', '');
currentClass=currentClass.replace('full-width', window.itemClass);
$(".three-fourth article").attr("class", currentClass);
$(".view-type li").removeClass("active");
$(this).addClass("active");
bookyourtravel_scripts.resizeFluidItems();
}
e.preventDefault();
});
$('.list-view').click(function(e){
var currentClass=$(".three-fourth article").attr("class");
if(typeof currentClass!='undefined'&¤tClass.length > 0){
currentClass=currentClass.replace('last', '');
currentClass=currentClass.replace(window.itemClass, 'full-width');
$(".three-fourth article").attr("class", currentClass);
$(".view-type li").removeClass("active");
$(this).addClass("active");
}
e.preventDefault();
});
if(window.defaultResultsView===0)
$('.view-type li.grid-view').trigger('click');
else
$('.view-type li.list-view').trigger('click');
},
load:function (){
bookyourtravel_scripts.resizeFluidItems();
},
resizeFluidItems: function(){
bookyourtravel_scripts.resizeFluidItem(".one-half.accommodation_item,.one-third.accommodation_item,.one-fourth.accommodation_item,.one-fifth.accommodation_item");
bookyourtravel_scripts.resizeFluidItem(".one-half.location_item,.one-third.location_item,.one-fourth.location_item,.one-fifth.location_item");
bookyourtravel_scripts.resizeFluidItem(".one-half.tour_item,.one-third.tour_item,.one-fourth.tour_item,.one-fifth.tour_item");
bookyourtravel_scripts.resizeFluidItem(".one-half.car_rental_item,.one-third.car_rental_item,.one-fourth.car_rental_item,.one-fifth.car_rental_item");
bookyourtravel_scripts.resizeFluidItem(".one-half.cruise_item,.one-third.cruise_item,.one-fourth.cruise_item,.one-fifth.cruise_item");
},
handleRibbonClick:function (e){
if($(this).hasClass('fn')){
return true;
}
else if(!$(this).hasClass('.lang_sel_sel,.lang_sel_other')&&$(this).closest("#lang_sel,#lang_sel_list,.wpml-ls").length > 0){
return true;
}else{
$(".ribbon .profile-nav li").hide();
if($(this).parent().parent().hasClass('open'))
$(this).parent().parent().removeClass('open');
else {
$(".ribbon .profile-nav").removeClass('open');
$(this).parent().parent().addClass('open');
}
$(this).parent().siblings().each(function(){
$(this).removeClass('active');
});
$(this).parent().attr('class', 'active');
$('.ribbon .profile-nav li.active').show();
$('.ribbon .profile-nav.open li').show();
return false;
}},
resizeFluidItem:function (filters){
var filterArray=filters.split(',');
var arrayLength=filterArray.length;
for (var i=0; i < arrayLength; i++){
var filter=filterArray[i];
var maxHeight=0;
$(filter + " .details").each(function(){
if($(this).height() > maxHeight){
maxHeight=$(this).height();
}});
$(filter + ":not(.fluid-item) .details").height(maxHeight);
}}
};})(jQuery);
if(!String.prototype.format){
String.prototype.format=function(){
var args=arguments;
return this.replace(/{(\d+)}/g, function(match, number){
return typeof args[number]!='undefined' ? args[number]:match;
});
};}
window.RedrawMap=(function(){
google.maps.event.trigger(MapInstance,'resize');
});
window.InitializeMap=(function(){
if(typeof window.entityLatitude!='undefined' &&
typeof window.entityLongitude!='undefined' &&
window.entityLatitude.length > 0 &&
window.entityLongitude.length > 0){
var latLong=new google.maps.LatLng(window.entityLatitude, window.entityLongitude);
var myMapOptions={
zoom: 15,
center: latLong,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var theMap=new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);
google.maps.event.trigger(theMap, 'resize');
var marker=new google.maps.Marker({
map: theMap,
draggable: true,
position: new google.maps.LatLng(window.entityLatitude, window.entityLongitude),
visible: true
});
var boxText=document.createElement("div");
boxText.innerHTML=window.entityInfoboxText;
var myOptions={
content: boxText,
disableAutoPan: false,
maxWidth: 0,
pixelOffset: new google.maps.Size(-163, -32),
zIndex: null,
closeBoxURL: "",
infoBoxClearance: new google.maps.Size(1, 1),
isHidden: false,
pane: "floatPane",
enableEventPropagation: false
};
google.maps.event.addListener(marker, "click", function (e){
ib.open(theMap, this);
});
var ib=new InfoBox(myOptions);
ib.open(theMap, marker);
}});
Object.size=function(obj){
var size=0, key;
for (key in obj){
if(obj.hasOwnProperty(key)) size++;
}
return size;
};
;
(function ($, undefined){
"use strict";
var defaults={
item: 3,
autoWidth: false,
slideMove: 1,
slideMargin: 10,
addClass: '',
mode: "slide",
useCSS: true,
cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',//
easing: 'linear', //'for jquery animation',//
speed: 400, //ms'
auto: false,
loop: false,
slideEndAnimatoin: true,
pause: 2000,
keyPress: false,
controls: true,
prevHtml: '',
nextHtml: '',
rtl: false,
adaptiveHeight: false,
vertical: false,
verticalHeight: 500,
vThumbWidth: 100,
thumbItem: 10,
pager: true,
gallery: false,
galleryMargin: 5,
thumbMargin: 5,
currentPagerPosition: 'middle',
enableTouch: true,
enableDrag: true,
freeMove: true,
swipeThreshold: 40,
responsive: [],
onBeforeStart: function ($el){},
onSliderLoad: function ($el){},
onBeforeSlide: function ($el, scene){},
onAfterSlide: function ($el, scene){},
onBeforeNextSlide: function ($el, scene){},
onBeforePrevSlide: function ($el, scene){}};
$.fn.lightSlider=function (options){
if(this.length===0){
return this;
}
if(this.length > 1){
this.each(function (){
$(this).lightSlider(options);
});
return this;
}
var plugin={},
settings=$.extend(true, {}, defaults, options),
settingsTemp={},
$el=this;
plugin.$el=this;
if(settings.mode==='fade'){
settings.vertical=false;
}
var $children=$el.children(),
windowW=$(window).width(),
breakpoint=null,
resposiveObj=null,
length=0,
w=0,
on=false,
elSize=0,
$slide='',
scene=0,
property=(settings.vertical===true) ? "height":"width",
gutter=(settings.vertical===true) ? "margin-bottom":"margin-right",
slideValue=0,
pagerWidth=0,
slideWidth=0,
thumbWidth=0,
interval=null,
isTouch=('ontouchstart' in document.documentElement);
var refresh=new Object();
refresh.chbreakpoint=function (){
windowW=$(window).width();
if(settings.responsive.length){
if(settings.autoWidth===false){
var item=settings.item;
}
if(windowW < settings.responsive[0].breakpoint){
for (var i=0; i < settings.responsive.length; i++){
if(windowW < settings.responsive[i].breakpoint){
breakpoint=settings.responsive[i].breakpoint;
resposiveObj=settings.responsive[i];
}}
}
if(typeof resposiveObj!=="undefined"&&resposiveObj!=null){
for (i in resposiveObj.settings){
if(typeof settingsTemp[i]=="undefined"||settingsTemp[i]==null){
settingsTemp[i]=settings[i];
}
settings[i]=resposiveObj.settings[i];
}}
if(!$.isEmptyObject(settingsTemp)&&windowW > settings.responsive[0].breakpoint){
for (i in settingsTemp){
settings[i]=settingsTemp[i];
}}
if(settings.autoWidth===false){
if(slideValue > 0&&slideWidth > 0){
if(item!==settings.item){
scene=Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove));
}}
}}
};
refresh.calSW=function (){
if(settings.autoWidth===false){
slideWidth=(elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item;
}};
refresh.calWidth=function (cln){
var ln=cln===true ? $slide.find('.lslide').length:$children.length;
if(settings.autoWidth===false){
w=ln * (slideWidth + settings.slideMargin);
}else{
w=0;
for (var i=0; i < ln; i++){
w +=(parseInt($children.eq(i).width()) + settings.slideMargin);
}}
if(w % 1!==0){
w=w + 1;
}
return w;
};
plugin={
doCss: function (){
var support=function (){
var transition=['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
var root=document.documentElement;
for (var i=0; i < transition.length; i++){
if(transition[i] in root.style){
return true;
}}
};
if(settings.useCSS&&support()){
return true;
}
return false;
},
keyPress: function (){
if(settings.keyPress){
$(document).on('keyup.lightslider', function (e){
e.preventDefault();
if(e.keyCode===37){
$el.goToPrevSlide();
clearInterval(interval);
}else if(e.keyCode===39){
$el.goToNextSlide();
clearInterval(interval);
}});
}},
controls: function (){
if(settings.controls){
$el.after('');
if(!settings.autoWidth){
if(length <=settings.item){
$slide.find('.lSAction').hide();
}}else{
if(refresh.calWidth(false) < elSize){
$slide.find('.lSAction').hide();
}}
$slide.find('.lSAction a').on('click', function (e){
e.preventDefault();
if($(this).attr('class')==='lSPrev'){
$el.goToPrevSlide();
}else{
$el.goToNextSlide();
}
clearInterval(interval);
return false;
});
}},
initialStyle: function (){
var $this=this;
if(settings.mode==='fade'){
settings.autoWidth=false;
settings.slideEndAnimatoin=false;
}
if(settings.auto){
settings.slideEndAnimatoin=false;
};
if(settings.autoWidth){
settings.slideMove=1;
settings.item=1;
}
if(settings.loop){
settings.slideMove=1;
settings.freeMove=false;
}
settings.onBeforeStart.call(this, $el);
refresh.chbreakpoint();
$el.addClass('lightSlider').wrap("");
$slide=$el.parent('.lSSlideWrapper');
if(settings.rtl===true){
$slide.parent().addClass('lSrtl');
}
if(settings.vertical){
$slide.parent().addClass('vertical');
elSize=settings.verticalHeight;
$slide.css('height', elSize + 'px');
}else{
elSize=$el.outerWidth();
}
$children.addClass('lslide');
if(settings.loop===true&&settings.mode==='slide'){
refresh.calSW();
refresh.clone=function (){
if(refresh.calWidth(true) > elSize){
var tWr=0,
tI=0;
for (var k=0; k < $children.length; k++){
tWr +=(parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin);
tI++;
if(tWr >=(elSize + settings.slideMargin)){
break;
}}
var tItem=settings.autoWidth===true ? tI:settings.item;
if(tItem < $el.find('.clone.left').length){
for (var i=0; i < $el.find('.clone.left').length - tItem; i++){
$children.eq(i).remove();
}}
if(tItem < $el.find('.clone.right').length){
for (var j=$children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--){
scene--;
$children.eq(j).remove();
}}
for (var k=$el.find('.clone.right').length; k < tItem; k++){
$el.find('.lslide').eq(k).clone().removeClass('lslide').addClass('clone right').appendTo($el);
scene++;
}
for (var m=$el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--){
$el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el);
}
$children=$el.children();
}else{
if($children.hasClass('clone')){
$el.find('.clone').remove();
$this.move($el, 0);
}}
};
refresh.clone();
}
refresh.sSW=function (){
length=$children.length;
if(settings.rtl===true&&settings.vertical===false){
gutter="margin-left";
}
if(settings.autoWidth===false){
$children.css(property, slideWidth + 'px');
}
$children.css(gutter, settings.slideMargin + 'px');
w=refresh.calWidth(false);
$el.css(property, w + 'px');
if(settings.loop===true&&settings.mode==='slide'){
if(on===false){
scene=$el.find('.clone.left').length;
}}
};
refresh.calL=function (){
$children=$el.children();
length=$children.length;
};
if(this.doCss()){
$slide.addClass('usingCss');
}
refresh.calL();
if(settings.mode==="slide"){
refresh.calSW();
refresh.sSW();
if(settings.loop===true){
slideValue=$this.slideValue();
this.move($el, slideValue);
}
if(settings.vertical===false){
this.setHeight($el, false, true);
}}else{
this.setHeight($el, true, true);
$el.addClass('lSFade');
if(!this.doCss()){
$children.not(".active").css('display', 'none');
}}
if(settings.loop===true&&settings.mode==='slide'){
$children.eq(scene).addClass('active');
}else{
$children.first().addClass('active');
}},
pager: function (){
var $this=this;
refresh.createPager=function (){
thumbWidth=(elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem;
var $children=$slide.find('.lslide');
var length=$slide.find('.lslide').length;
var i=0,
pagers='',
v=0;
for (i=0; i < length; i++){
if(settings.mode==='slide'){
if(!settings.autoWidth){
v=i * ((slideWidth + settings.slideMargin) * settings.slideMove);
}else{
v +=((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove);
}}
var thumb=$children.eq(i * settings.slideMove).attr('data-thumb');
if(settings.gallery===true){
pagers +='';
}else{
pagers +='' + (i + 1) + '';
}
if(settings.mode==='slide'){
if((v) >=w - elSize - settings.slideMargin){
i=i + 1;
var minPgr=2;
if(settings.autoWidth){
pagers +='' + (i + 1) + '';
minPgr=1;
}
if(i < minPgr){
pagers=null;
$slide.parent().addClass('noPager');
}else{
$slide.parent().removeClass('noPager');
}
break;
}}
}
var $cSouter=$slide.parent();
$cSouter.find('.lSPager').html(pagers);
if(!settings.vertical&&settings.gallery){
var $pgr=$slide.parent().find('.lSGallery');
setTimeout(function (){
$this.setHeight($pgr, false, false);
});
}
if(settings.gallery===true){
if(settings.vertical===true){
$cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px');
}
pagerWidth=(i * (settings.thumbMargin + thumbWidth)) + 0.5;
$cSouter.find('.lSPager').css({
property: pagerWidth + 'px',
'transition-duration': settings.speed + 'ms'
});
if(settings.vertical===true){
$slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px');
}
$cSouter.find('.lSPager').css(property, pagerWidth + 'px');
}
var $pager=$cSouter.find('.lSPager').find('li');
$pager.first().addClass('active');
$pager.on('click', function (){
if(settings.loop===true&&settings.mode==='slide'){
scene=scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index());
}else{
scene=$pager.index(this);
}
$el.mode(false);
if(settings.gallery===true){
$this.slideThumb();
}
clearInterval(interval);
return false;
});
};
if(settings.pager){
var cl='lSpg';
if(settings.gallery){
cl='lSGallery';
}
$slide.after('');
var gMargin=(settings.vertical) ? "margin-left":"margin-top";
$slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px');
refresh.createPager();
}
setTimeout(function (){
refresh.init();
}, 0);
},
setHeight: function (ob, fade, loop){
var obj=null;
if(loop){
obj=ob.children(".lslide ").first();
}else{
obj=ob.children().first();
}
var setCss=function (){
var tH=obj.height(),
tP=0,
tHT=tH;
if(fade){
tH=0;
tP=((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
};
setCss();
obj.find('img').load(function (){
setTimeout(function(){
setCss();
},100);
});
},
active: function (ob, t){
if(this.doCss()&&settings.mode==="fade"){
$slide.addClass('on');
}
var sc=0;
if(scene * settings.slideMove < length){
ob.removeClass('active');
if(!this.doCss()&&settings.mode==="fade"&&t===false){
ob.fadeOut(settings.speed);
}
t===true ? sc=scene:sc=scene * settings.slideMove;
if(t===true){
var l=ob.length;
var nl=l - 1;
if(sc + 1 >=l){
sc=nl;
}}
if(settings.loop===true&&settings.mode==='slide'){
t===true ? sc=scene - $el.find('.clone.left').length:sc=scene * settings.slideMove;
if(t===true){
var l=ob.length;
var nl=l - 1;
if(sc + 1==l){
sc=nl;
}else if(sc + 1 > l){
sc=0;
}}
}
if(!this.doCss()&&settings.mode==="fade"&&t===false){
ob.eq(sc).fadeIn(settings.speed);
}
ob.eq(sc).addClass('active');
}else{
ob.removeClass('active');
ob.eq(ob.length - 1).addClass('active');
if(!this.doCss()&&settings.mode==="fade"&&t===false){
ob.fadeOut(settings.speed);
ob.eq(sc).fadeIn(settings.speed);
}}
},
move: function (ob, v){
if(settings.rtl===true){
v=-v;
}
if(this.doCss()){
if(settings.vertical===true){
ob.css({
'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)',
'-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)'
});
}else{
ob.css({
'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
'-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
});
}}else{
if(settings.vertical===true){
ob.css('position', 'relative').animate({
top: -v + 'px'
}, settings.speed, settings.easing);
}else{
ob.css('position', 'relative').animate({
left: -v + 'px'
}, settings.speed, settings.easing);
}}
var $thumb=$slide.parent().find('.lSPager').find('li');
this.active($thumb, true);
},
fade: function (){
this.active($children, false);
var $thumb=$slide.parent().find('.lSPager').find('li');
this.active($thumb, true);
},
slide: function (){
var $this=this;
refresh.calSlide=function (){
if(w > elSize){
slideValue=$this.slideValue();
$this.active($children, false);
if((slideValue) > w - elSize - settings.slideMargin){
slideValue=w - elSize - settings.slideMargin;
}else if(slideValue < 0){
slideValue=0;
}
$this.move($el, slideValue);
if(settings.loop===true&&settings.mode==='slide'){
if(scene >=(length - ($el.find('.clone.left').length / settings.slideMove))){
$this.resetSlide($el.find('.clone.left').length);
}
if(scene===0){
$this.resetSlide($slide.find('.lslide').length);
}}
}};
refresh.calSlide();
},
resetSlide: function (s){
var $this=this;
$slide.find('.lSAction a').addClass('disabled');
setTimeout(function (){
scene=s;
$slide.css('transition-duration', '0ms');
slideValue=$this.slideValue();
$this.active($children, false);
plugin.move($el, slideValue);
setTimeout(function (){
$slide.css('transition-duration', settings.speed + 'ms');
$slide.find('.lSAction a').removeClass('disabled');
}, 50);
}, settings.speed + 100);
},
slideValue: function (){
var _sV=0;
if(settings.autoWidth===false){
_sV=scene * ((slideWidth + settings.slideMargin) * settings.slideMove);
}else{
_sV=0;
for (var i=0; i < scene; i++){
_sV +=(parseInt($children.eq(i).width()) + settings.slideMargin);
}}
return _sV;
},
slideThumb: function (){
var position;
switch (settings.currentPagerPosition){
case 'left':
position=0;
break;
case 'middle':
position=(elSize / 2) - (thumbWidth / 2);
break;
case 'right':
position=elSize - thumbWidth;
}
var sc=scene - $el.find('.clone.left').length;
var $pager=$slide.parent().find('.lSPager');
if(settings.mode==='slide'&&settings.loop===true){
if(sc >=$pager.children().length){
sc=0;
}else if(sc < 0){
sc=$pager.children().length;
}}
var thumbSlide=sc * ((thumbWidth + settings.thumbMargin)) - (position);
if((thumbSlide + elSize) > pagerWidth){
thumbSlide=pagerWidth - elSize - settings.thumbMargin;
}
if(thumbSlide < 0){
thumbSlide=0;
}
this.move($pager, thumbSlide);
},
auto: function (){
if(settings.auto){
interval=setInterval(function (){
$el.goToNextSlide();
}, settings.pause);
}},
touchMove: function (endCoords, startCoords){
$slide.css('transition-duration', '0ms');
if(settings.mode==='slide'){
var distance=endCoords - startCoords;
var swipeVal=slideValue - distance;
if((swipeVal) >=w - elSize - settings.slideMargin){
if(settings.freeMove===false){
swipeVal=w - elSize - settings.slideMargin;
}else{
var swipeValT=w - elSize - settings.slideMargin;
swipeVal=swipeValT + ((swipeVal - swipeValT) / 5);
}}else if(swipeVal < 0){
if(settings.freeMove===false){
swipeVal=0;
}else{
swipeVal=swipeVal / 5;
}}
this.move($el, swipeVal);
}},
touchEnd: function (distance){
$slide.css('transition-duration', settings.speed + 'ms');
clearInterval(interval);
if(settings.mode==='slide'){
var mxVal=false;
var _next=true;
slideValue=slideValue - distance;
if((slideValue) > w - elSize - settings.slideMargin){
slideValue=w - elSize - settings.slideMargin;
if(settings.autoWidth===false){
mxVal=true;
}}else if(slideValue < 0){
slideValue=0;
}
var gC=function (next){
var ad=0;
if(!mxVal){
if(next){
ad=1;
};}
if(!settings.autoWidth){
var num=slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove);
scene=parseInt(num) + ad;
if(slideValue >=(w - elSize - settings.slideMargin)){
if(num % 1!==0){
scene++;
}}
}else{
var tW=0;
for (var i=0; i < $children.length; i++){
tW +=(parseInt($children.eq(i).width()) + settings.slideMargin);
scene=i + ad;
if(tW >=slideValue){
break;
}}
}};
if(distance >=settings.swipeThreshold){
gC(false);
_next=false;
}else if(distance <=-settings.swipeThreshold){
gC(true);
_next=false;
}
$el.mode(_next);
this.slideThumb();
}else{
if(distance >=settings.swipeThreshold){
$el.goToPrevSlide();
}else if(distance <=-settings.swipeThreshold){
$el.goToNextSlide();
}}
},
enableDrag: function (){
var $this=this;
if(!isTouch){
var startCoords=0,
endCoords=0,
isDraging=false;
$slide.on('mousedown', function (e){
if(w < elSize){
if(w!==0){
return false;
}}
if($(e.target).attr('class')!==('lSPrev')&&$(e.target).attr('class')!==('lSNext')){
startCoords=(settings.vertical===true) ? e.pageY:e.pageX;
isDraging=true;
e.preventDefault();
}});
$(window).on('mousemove', function (e){
if(isDraging){
endCoords=(settings.vertical===true) ? e.pageY:e.pageX;
$this.touchMove(endCoords, startCoords);
}});
$(window).on('mouseup', function (e){
if(isDraging){
isDraging=false;
endCoords=(settings.vertical===true) ? e.pageY:e.pageX;
var distance=endCoords - startCoords;
if(Math.abs(distance) >=settings.swipeThreshold){
$(window).on('click.ls', function(e){
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
$(window).off('click.ls');
});
}
$this.touchEnd(distance);
}});
}},
enableTouch: function (){
var $this=this;
if(isTouch){
var startCoords={},
endCoords={};
$slide.on('touchstart', function (e){
endCoords=e.originalEvent.targetTouches[0];
startCoords.pageX=e.originalEvent.targetTouches[0].pageX;
startCoords.pageY=e.originalEvent.targetTouches[0].pageY;
});
$slide.on('touchmove', function (e){
if(w < elSize){
if(w!==0){
return false;
}}
var orig=e.originalEvent;
endCoords=orig.targetTouches[0];
var xMovement=Math.abs(endCoords.pageX - startCoords.pageX);
var yMovement=Math.abs(endCoords.pageY - startCoords.pageY);
if(settings.vertical===true){
if((yMovement * 3) > xMovement){
e.preventDefault();
}
$this.touchMove(endCoords.pageY, startCoords.pageY);
}else{
if((xMovement * 3) > yMovement){
e.preventDefault();
}
$this.touchMove(endCoords.pageX, startCoords.pageX);
}});
$slide.on('touchend', function (){
if(w < elSize){
if(w!==0){
return false;
}}
if(settings.vertical===true){
var distance=endCoords.pageY - startCoords.pageY;
}else{
var distance=endCoords.pageX - startCoords.pageX;
}
$this.touchEnd(distance);
});
}},
build: function (){
var $this=this;
$this.initialStyle();
$this.auto();
if(this.doCss()){
if(settings.enableTouch===true){
$this.enableTouch();
}
if(settings.enableDrag===true){
$this.enableDrag();
}}
$this.pager();
$this.controls();
$this.keyPress();
}};
plugin.build();
refresh.init=function (){
refresh.chbreakpoint();
if(settings.vertical===true){
if(settings.item > 1){
elSize=settings.verticalHeight;
}else{
elSize=$children.outerHeight();
}
$slide.css('height', elSize + 'px');
}else{
elSize=$slide.outerWidth();
}
if(settings.loop===true&&settings.mode==='slide'){
refresh.clone();
}
refresh.calL();
if(settings.mode==="slide"){
$el.removeClass('lSSlide');
}
if(settings.mode==="slide"){
refresh.calSW();
refresh.sSW();
}
setTimeout(function (){
if(settings.mode==="slide"){
$el.addClass('lSSlide');
}}, 1000);
if(settings.pager){
refresh.createPager();
}
if(settings.adaptiveHeight===true&&settings.vertical===false){
$el.css('height', $children.eq(scene).height());
}
if(settings.gallery===true){
plugin.slideThumb();
}
if(settings.mode==="slide"){
plugin.slide();
}
if(settings.autoWidth===false){
if($children.length <=settings.item){
$slide.find('.lSAction').hide();
}else{
$slide.find('.lSAction').show();
}}else{
if((refresh.calWidth(false) < elSize)&&(w!==0)){
$slide.find('.lSAction').hide();
}else{
$slide.find('.lSAction').show();
}}
};
$el.goToPrevSlide=function (){
if(scene > 0){
settings.onBeforePrevSlide.call(this, $el, scene);
scene--;
$el.mode(false);
if(settings.gallery===true){
plugin.slideThumb();
}}else{
if(settings.loop===true){
settings.onBeforePrevSlide.call(this, $el, scene);
if(settings.mode==='fade'){
var l=(length - 1);
scene=parseInt(l / settings.slideMove);
}
$el.mode(false);
if(settings.gallery===true){
plugin.slideThumb();
}}else if(settings.slideEndAnimatoin===true){
$el.addClass('leftEnd');
setTimeout(function (){
$el.removeClass('leftEnd');
}, 400);
}}
};
$el.goToNextSlide=function (){
var nextI=true;
if(settings.mode==='slide'){
var _slideValue=plugin.slideValue();
var nextI=_slideValue < w - elSize - settings.slideMargin;
}
if(((scene * settings.slideMove) < length - settings.slideMove)&&nextI){
settings.onBeforeNextSlide.call(this, $el, scene);
scene++;
$el.mode(false);
if(settings.gallery===true){
plugin.slideThumb();
}}else{
if(settings.loop===true){
settings.onBeforeNextSlide.call(this, $el, scene);
scene=0;
$el.mode(false);
if(settings.gallery===true){
plugin.slideThumb();
}}else if(settings.slideEndAnimatoin===true){
$el.addClass('rightEnd');
setTimeout(function (){
$el.removeClass('rightEnd');
}, 400);
}}
};
$el.mode=function (_touch){
if(settings.adaptiveHeight===true&&settings.vertical===false){
$el.css('height', $children.eq(scene).height());
}
if(on===false){
if(settings.mode==="slide"){
if(plugin.doCss()){
$el.addClass('lSSlide');
if(settings.speed!==''){
$slide.css('transition-duration', settings.speed + 'ms');
}
if(settings.cssEasing!==''){
$slide.css('transition-timing-function', settings.cssEasing);
}}
}else{
if(plugin.doCss()){
if(settings.speed!==''){
$el.css('transition-duration', settings.speed + 'ms');
}
if(settings.cssEasing!==''){
$el.css('transition-timing-function', settings.cssEasing);
}}
}}
if(!_touch){
settings.onBeforeSlide.call(this, $el, scene);
}
if(settings.mode==="slide"){
plugin.slide();
}else{
plugin.fade();
}
setTimeout(function (){
if(!_touch){
settings.onAfterSlide.call(this, $el, scene);
}}, settings.speed);
on=true;
};
$el.play=function (){
clearInterval(interval);
$el.goToNextSlide();
interval=setInterval(function (){
$el.goToNextSlide();
}, settings.pause);
};
$el.pause=function (){
clearInterval(interval);
};
$el.refresh=function (){
refresh.init();
};
$el.getCurrentSlideCount=function (){
var sc=scene;
if(settings.loop){
var ln=$slide.find('.lslide').length,
cl=$el.find('.clone.left').length;
if(scene<=cl-1){
sc=ln + (scene-cl);
}else if(scene >=(ln+cl)){
sc=scene - ln - cl;
}else{
sc=scene - cl;
}};
return sc+1;
};
$el.getTotalSlideCount=function(){
return $slide.find('.lslide').length;
};
$el.goToSlide=function (s){
if(settings.loop){
scene=(s + $el.find('.clone.left').length -1);
}else{
scene=s;
}
$el.mode(false);
if(settings.gallery===true){
plugin.slideThumb();
}};
setTimeout(function(){
settings.onSliderLoad.call(this, $el);
},10);
$(window).on('resize orientationchange', function (e){
setTimeout(function (){
e.preventDefault();
refresh.init();
}, 200);
});
return this;
};}(jQuery));
!function(g){g.extend({tablesorter:new function(){function d(){var b=arguments[0],a=1':"";m.$headers=g(b).find(m.selectorHeaders).each(function(b){c=g(this);a=m.headers[b];m.headerContent[b]=g(this).html();t=m.headerTemplate.replace(/\{content\}/g,g(this).html()).replace(/\{icon\}/g,e);m.onRenderTemplate&&(h=m.onRenderTemplate.apply(c,[b,t]))&&"string"===typeof h&&(t=h);g(this).html('");m.onRenderHeader&&m.onRenderHeader.apply(c,[b]);this.column=parseInt(g(this).attr("data-column"),10);this.order=C(f.getData(c,a,"sortInitialOrder")||m.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1; k=f.getData(c,a,"lockedOrder")||!1;"undefined"!==typeof k&&!1!==k&&(this.order=this.lockedOrder=C(k)?[1,1,1]:[0,0,0]);c.addClass(f.css.header+" "+m.cssHeader);m.headerList[b]=this;c.parent().addClass(f.css.headerRow+" "+m.cssHeaderRow).attr("role","row");m.tabIndex&&c.attr("tabindex",0)}).attr({scope:"col",role:"columnheader"});B(b);m.debug&&(u("Built headers:",l),d(m.$headers))}function E(b,a,c){var h=b.config;h.$table.find(h.selectorRemove).remove();s(b);x(b);H(h.$table,a,c)}function B(b){var a, c,h=b.config;h.$headers.each(function(e,t){c=g(t);a="false"===f.getData(t,h.headers[e],"sorter");t.sortDisabled=a;c[a?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+a);b.id&&(a?c.removeAttr("aria-controls"):c.attr("aria-controls",b.id))})}function G(b){var a,c,h=b.config,e=h.sortList,t=e.length,d=f.css.sortNone+" "+h.cssNone,l=[f.css.sortAsc+" "+h.cssAsc,f.css.sortDesc+" "+h.cssDesc],m=["ascending","descending"],n=g(b).find("tfoot tr").children().add(h.$extraHeaders).removeClass(l.join(" ")); h.$headers.removeClass(l.join(" ")).addClass(d).attr("aria-sort","none");for(a=0;a"),c=g(b).width();g(b.tBodies[0]).find("tr:first").children("td:visible").each(function(){a.append(g("").css("width",parseInt(g(this).width()/c*1E3,10)/10+"%"))});g(b).prepend(a)}}function M(b,a,c){var h,e, f,d=b.config;b=a||d.sortList;d.sortList=[];g.each(b,function(b,a){h=[parseInt(a[0],10),parseInt(a[1],10)];if(f=d.$headers.filter('[data-column="'+h[0]+'"]:last')[0])d.sortList.push(h),e=g.inArray(h[1],f.order),c&&(f.count+=1),f.count=0<=e?e:h[1]%(d.sortReset?3:2)})}function N(b,a){return b&&b[a]?b[a].type||"":""}function O(b,a,c){var h,e,d,k=b.config,l=!c[k.sortMultiSortKey],m=k.$table;m.trigger("sortStart",b);a.count=c[k.sortResetKey]?2:(a.count+1)%(k.sortReset?3:2);k.sortRestart&&(e=a,k.$headers.each(function(){this===e||!l&&g(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));e=a.column;if(l){k.sortList=[];if(null!==k.sortForce)for(h=k.sortForce,c=0;ch&&(k.sortList.push([e,h]),1h&&(k.sortList.push([e,h]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",header:"tablesorter-header", headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"};f.language={sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"}; f.log=d;f.benchmark=u;f.construct=function(b){return this.each(function(){var a=g.extend(!0,{},f.defaults,b);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName?f.buildTable(this,a):f.setup(this,a)})};f.setup=function(b,a){if(!b||!b.tHead||0===b.tBodies.length||!0===b.hasInitialized)return a.debug?d("ERROR: stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var c="",h=g(b),e=g.metadata;b.hasInitialized=!1;b.isProcessing=!0;b.config=a;g.data(b,"tablesorter", a);a.debug&&g.data(b,"startoveralltimer",new Date);a.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1'), c=g.fn.detach?a.detach():a.remove();c=g(b).find("span.tablesorter-savemyplace");a.insertAfter(c);c.remove();b.isProcessing=!1};f.clearTableBody=function(b){g(b)[0].config.$tbodies.empty()};f.bindEvents=function(b,a,c){b=g(b)[0];var d,e=b.config;!0!==c&&(e.$extraHeaders=e.$extraHeaders?e.$extraHeaders.add(a):a);a.find(e.selectorSort).add(a.filter(e.selectorSort)).unbind(["mousedown","mouseup","sort","keyup",""].join(e.namespace+" ")).bind(["mousedown","mouseup","sort","keyup",""].join(e.namespace+ " "),function(c,f){var l;l=c.type;if(!(1!==(c.which||c.button)&&!/sort|keyup/.test(l)||"keyup"===l&&13!==c.which||"mouseup"===l&&!0!==f&&250<(new Date).getTime()-d)){if("mousedown"===l)return d=(new Date).getTime(),"INPUT"===c.target.tagName?"":!e.cancelSelection;e.delayInit&&n(e.cache)&&x(b);l=g.fn.closest?g(this).closest("th, td")[0]:/TH|TD/.test(this.tagName)?this:g(this).parents("th, td")[0];l=e.$headers[a.index(l)];l.sortDisabled||O(b,l,c)}});e.cancelSelection&&a.attr("unselectable","on").bind("selectstart", !1).css({"user-select":"none",MozUserSelect:"none"})};f.restoreHeaders=function(b){var a=g(b)[0].config;a.$table.find(a.selectorHeaders).each(function(b){g(this).find("."+f.css.headerIn).length&&g(this).html(a.headerContent[b])})};f.destroy=function(b,a,c){b=g(b)[0];if(b.hasInitialized){f.refreshWidgets(b,!0,!0);var d=g(b),e=b.config,t=d.find("thead:first"),k=t.find("tr."+f.css.headerRow).removeClass(f.css.headerRow+" "+e.cssHeaderRow),l=d.find("tfoot:first > tr").children("th, td");!1===a&&0<=g.inArray("uitheme", e.widgets)&&(d.trigger("applyWidgetId",["uitheme"]),d.trigger("applyWidgetId",["zebra"]));t.find("tr").not(k).remove();d.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(e.namespace+" "));e.$headers.add(l).removeClass([f.css.header,e.cssHeader,e.cssAsc,e.cssDesc,f.css.sortAsc,f.css.sortDesc,f.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled", "true");k.find(e.selectorSort).unbind(["mousedown","mouseup","keypress",""].join(e.namespace+" "));f.restoreHeaders(b);d.toggleClass(f.css.table+" "+e.tableClass+" tablesorter-"+e.theme,!1===a);b.hasInitialized=!1;delete b.config.cache;"function"===typeof c&&c(b)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i};f.sortNatural=function(b,a){if(b===a)return 0;var c,d,e,g,k,l;d=f.regex;if(d.hex.test(a)){c=parseInt(b.match(d.hex), 16);e=parseInt(a.match(d.hex),16);if(ce)return 1}c=b.replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0");d=a.replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0");l=Math.max(c.length,d.length);for(k=0;kg)return 1}return 0};f.sortNaturalAsc=function(b,a,c,d,e){if(b===a)return 0; c=e.string[e.empties[c]||e.emptyTo];return""===b&&0!==c?"boolean"===typeof c?c?-1:1:-c||-1:""===a&&0!==c?"boolean"===typeof c?c?1:-1:c||1:f.sortNatural(b,a)};f.sortNaturalDesc=function(b,a,c,d,e){if(b===a)return 0;c=e.string[e.empties[c]||e.emptyTo];return""===b&&0!==c?"boolean"===typeof c?c?-1:1:c||1:""===a&&0!==c?"boolean"===typeof c?c?1:-1:-c||-1:f.sortNatural(a,b)};f.sortText=function(b,a){return b>a?1:bg.inArray(k[h].id,n))&&(e.debug&&d('Refeshing widgets: Removing "'+k[h].id+'"'),k[h].hasOwnProperty("remove")&&e.widgetInit[k[h].id]&&(k[h].remove(b,e,e.widgetOptions),e.widgetInit[k[h].id]=!1));!0!==c&&f.applyWidget(b,a)};f.getData=function(b,a,c){var d="";b=g(b);var e,f;if(!b.length)return"";e=g.metadata?b.metadata():!1;f=" "+(b.attr("class")||"");"undefined"!==typeof b.data(c)||"undefined"!==typeof b.data(c.toLowerCase())? d+=b.data(c)||b.data(c.toLowerCase()):e&&"undefined"!==typeof e[c]?d+=e[c]:a&&"undefined"!==typeof a[c]?d+=a[c]:" "!==f&&f.match(" "+c+"-")&&(d=f.match(RegExp("\\s"+c+"-([\\w-]+)"))[1]||"");return g.trim(d)};f.formatFloat=function(b,a){if("string"!==typeof b||""===b)return b;var c;b=(a&&a.config?!1!==a.config.usNumberFormat:"undefined"!==typeof a?a:1)?b.replace(/,/g,""):b.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(b)&&(b=b.replace(/^\s*\(([.\d]+)\)/,"-$1"));c=parseFloat(b);return isNaN(c)? g.trim(b):c};f.isDigit=function(b){return isNaN(b)?/^[\-+(]?\d+[)]?$/.test(b.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=g.tablesorter;g.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(d,u){var n=u.config;d&&(d=g.trim(n.ignoreCase?d.toLocaleLowerCase():d),d=n.sortLocaleCompare?p.replaceAccents(d):d);return d},type:"text"});p.addParser({id:"digit",is:function(d){return p.isDigit(d)},format:function(d,u){var n=p.formatFloat((d||"").replace(/[^\w,. \-()]/g, ""),u);return d&&"number"===typeof n?n:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"currency",is:function(d){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((d||"").replace(/[+\-,. ]/g,""))},format:function(d,u){var n=p.formatFloat((d||"").replace(/[^\w,. \-()]/g,""),u);return d&&"number"===typeof n?n:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"ipAddress", is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,g){var n,v=d?d.split("."):"",s="",x=v.length;for(n=0;nd.length},format:function(d,g){return d?p.formatFloat(d.replace(/%/g,""),g):d},type:"numeric"});p.addParser({id:"usLongDate",is:function(d){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(d)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(d)},format:function(d,g){return d?p.formatFloat((new Date(d.replace(/(\S)([AP]M)$/i, "$1 $2"))).getTime()||d,g):d},type:"numeric"});p.addParser({id:"shortDate",is:function(d){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((d||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(d,g,n,v){if(d){n=g.config;var s=n.$headers.filter("[data-column="+v+"]:last");v=s.length&&s[0].dateFormat||p.getData(s,n.headers[v],"dateFormat")||n.dateFormat;d=d.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===v?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$1/$2"):"ddmmyyyy"===v?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===v&&(d=d.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return d?p.formatFloat((new Date(d)).getTime()||d,g):d},type:"numeric"});p.addParser({id:"time",is:function(d){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(d)},format:function(d,g){return d?p.formatFloat((new Date("2000/01/01 "+d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||d,g):d},type:"numeric"});p.addParser({id:"metadata", is:function(){return!1},format:function(d,p,n){d=p.config;d=d.parserMetadataName?d.parserMetadataName:"sortValue";return g(n).metadata()[d]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(d,u,n){var v,s,x,y,C,D,E=RegExp(u.cssChildRow,"i"),B=u.$tbodies;u.debug&&(C=new Date);for(d=0;d 0){
var $input=null;
if(field.type=='text'||field.type=='email'){
$input=$('.car_rental-booking-form').find('input[name=' + field.id + ']');
}else if(field.type=='textarea'){
$input=$('.car_rental-booking-form').find('textarea[name=' + field.id + ']');
}
if($input!==null&&typeof($input)!=='undefined'){
if(field.required=='1'){
$input.rules('add', {
required: true,
messages: {
required: window.bookingFormRequiredError
}});
}
if(field.type=='email'){
$input.rules('add', {
email: true,
messages: {
required: window.bookingFormEmailError
}});
}}
}});
}
$('.booking-commands').hide();
$('.extra_item_quantity').uniform();
$('.booking_form_drop_off').uniform();
$('.radio').bind('click.uniform',
function (e){
if($(this).find("span").hasClass('checked'))
$(this).find("input").attr('checked', true);
else
$(this).find("input").attr('checked', false);
}
);
car_rentals.bindGallery();
car_rentals.bindResetButton();
car_rentals.bindNextButton();
car_rentals.bindCancelButton();
if(window.enableExtraItems){
car_rentals.bindExtraItemsQuantitySelect();
car_rentals.buildExtraItemsTable();
}
car_rentals.populateCarRentalBookedOutDates(window.carRentalId, window.currentMonth, window.currentYear, car_rentals.bindCarRentalDatePicker);
},
bindRequiredExtraItems: function(){
if(typeof(window.requiredExtraItems)!=='undefined'&&window.requiredExtraItems.length > 0){
$.each(window.requiredExtraItems, function(index, extraItemId){
car_rentals.updateExtraItemSelection(extraItemId, 1);
$('#extra_item_quantity_' + extraItemId).val('1');
});
}},
bindNextButton:function(){
$('.book-car_rental-proceed').unbind('click');
$('.book-car_rental-proceed').on('click', function(event){
if(!window.carRentalIsReservationOnly&&window.useWoocommerceForCheckout){
car_rentals.addProductToCart();
}else{
$('#wait_loading').show();
car_rentals.showCarRentalBookingForm();
$('#wait_loading').hide();
$('body,html').animate({
scrollTop: 0
}, 800);
}
event.preventDefault();
});
},
bindResetButton:function(){
$('.book-car_rental-reset').unbind('click');
$('.book-car_rental-reset').on('click', function(event){
window.bookingRequest={};
window.bookingRequest.extraItems={};
window.bookingRequest.people=1;
window.bookingRequest.extraItemsTotalPrice=0;
window.bookingRequest.totalPrice=0;
window.bookingRequest.totalCarRentalOnlyPrice=0;
window.bookingRequest.totalDays=1;
event.preventDefault();
$(".extra_item_quantity").val("0");
$("#start_date_span").html('');
$("#start_date").val('');
$("#end_date_span").html('');
$("#end_date").val('');
$(".dates_row").hide();
$(".price_row").hide();
$('.booking-commands').hide();
$('table.car_rental_price_breakdown thead').html('');
$('table.car_rental_price_breakdown tbody').html('');
$('table.car_rental_price_breakdown tfoot').html('');
$('.reservation_total').html(car_rentals.formatPrice(window.bookingRequest.totalCarRentalOnlyPrice));
$('.extra_items_total').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
$('.total_price').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$('.confirm_total_price_p').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$('.extra_items_total').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
$('table.extra_items_price_breakdown tbody').html('');
car_rentals.populateCarRentalBookedOutDates(window.carRentalId, window.currentMonth, window.currentYear, car_rentals.refreshDatePicker);
});
},
bindCancelButton: function(){
$('#cancel-car_rental-booking').unbind('click');
$('#cancel-car_rental-booking').on('click', function(event){
car_rentals.hideCarRentalBookingForm();
car_rentals.showCarRentalScreen();
$('.error').hide();
event.preventDefault();
});
},
showCarRentalScreen:function (){
$('.three-fourth .lSSlideOuter').show();
$('.three-fourth .inner-nav').show();
$('.three-fourth .tab-content').show();
$(".tab-content").hide();
$(".tab-content:first").show();
$(".inner-nav li:first").addClass("active");
},
showCarRentalBookingForm:function (){
$('.booking_form_car_name_p').html(window.carRentalTitle);
$('.booking_form_car_type_p').html(window.carRentalCarType);
$('.booking_form_pick_up_from_p').html(window.carRentalPickUp);
$('.booking_form_drop_off_p').html($('#booking_form_drop_off option:selected').text());
$('.booking_form_date_from_p').html(window.bookingRequest.selectedDateFrom);
$('.booking_form_date_to_p').html(window.bookingRequest.selectedDateTo);
$('.booking_form_reservation_total_p').html(car_rentals.formatPrice(window.bookingRequest.totalCarRentalOnlyPrice));
$('.booking_form_extra_items_total_p').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
$('.booking_form_total_p').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$('.three-fourth .lSSlideOuter').hide();
$('.three-fourth .inner-nav').hide();
$('.three-fourth .tab-content').hide();
$('#car_rental-booking-form').show();
$('html, body').animate({
scrollTop: $('#car_rental-booking-form').offset().top
}, 1000);
},
hideCarRentalBookingForm:function (){
$('#car_rental-booking-form').hide();
},
showCarRentalConfirmationForm:function (){
$('#car_rental-confirmation-form').show();
},
bindGallery:function(){
$("#gallery").lightSlider({
item:1,
rtl: (window.enableRtl ? true:false),
slideMargin:0,
auto:true,
loop:true,
speed:1500,
pause:window.pauseBetweenSlides,
keyPress:true,
gallery:true,
thumbItem:8,
galleryMargin:3,
onSliderLoad: function(){
$('#gallery').removeClass('cS-hidden');
}});
},
bindCarRentalDatePicker:function (){
if(typeof $('.car_booking_form_datepicker')!=='undefined'){
$('.car_booking_form_datepicker').datepicker({
dateFormat: window.datepickerDateFormat,
numberOfMonths: [2, 2],
minDate: 0,
beforeShowDay: function(d){
var dUtc=Date.UTC(d.getFullYear(), d.getMonth(), d.getDate());
var today=new Date();
var todayUtc=Date.UTC(today.getFullYear(), today.getMonth(), today.getDate());
var selectedTimeFrom=car_rentals.getSelectedTimeFrom();
var selectedTimeTo=car_rentals.getSelectedTimeTo();
if(window.carRentalBookedOutDays){
var dateTextForCompare=d.getFullYear() + '-' + ("0" + (d.getMonth() + 1)).slice(-2) + '-' + ("0" + d.getDate()).slice(-2);
var dateTextForCompare2=d.getFullYear() + '-' + ("0" + (d.getMonth() + 1)).slice(-2) + '-' + ("0" + d.getDate()).slice(-2) + " 00:00:00";
if(selectedTimeFrom&&dUtc==selectedTimeFrom)
return [false, 'ui-datepicker-unselectable ui-state-disabled dp-highlight dp-highlight-selected'];
if($.inArray(dateTextForCompare, window.carRentalBookedOutDays) > -1||$.inArray(dateTextForCompare2, window.carRentalBookedOutDays) > -1)
return [false, 'ui-datepicker-unselectable ui-state-disabled'];
}
if(selectedTimeFrom&&((dUtc==selectedTimeFrom)||(selectedTimeTo&&dUtc >=selectedTimeFrom&&dUtc <=selectedTimeTo)))
return [false, "ui-datepicker-unselectable ui-state-disabled dp-highlight dp-highlight-selected"];
else if(todayUtc.valueOf() > dUtc)
return [false, "ui-datepicker-unselectable ui-state-disabled"];
else
return [true, "dp-highlight"];
},
onSelect: function(dateText, inst){
var selectedTime=Date.UTC(inst.currentYear, inst.currentMonth, inst.currentDay),
selectedDate=car_rentals.convertLocalToUTC(new Date(selectedTime)),
selectedDateFrom=car_rentals.getSelectedDateFrom(),
selectedDateTo=car_rentals.getSelectedDateTo(),
dateTest=true;
if(!selectedDateFrom||selectedDateTo||(selectedDate < selectedDateFrom)||(selectedDateFrom.toString()===selectedDate.toString())){
car_rentals.selectDateFrom(selectedTime, dateText);
}else{
for (var d=selectedDateFrom; d <=selectedDate; d.setDate(d.getDate() + 1)){
var dateToCheck=(d.getFullYear() + '-' + ("0" + (d.getMonth() + 1)).slice(-2) + '-' + ("0" + d.getDate()).slice(-2));
var dateToCheck2=d.getFullYear() + '-' + ("0" + (d.getMonth() + 1)).slice(-2) + '-' + ("0" + d.getDate()).slice(-2) + " 00:00:00";
var datesArray=window.carRentalBookedOutDays;
if($.inArray(dateToCheck, datesArray) > -1){
dateTest=false;
break;
}
if($.inArray(dateToCheck2, datesArray) > -1){
dateTest=false;
break;
}}
if(!dateTest){
car_rentals.selectDateFrom(selectedTime, dateText);
}else{
$("div.error.step1_error div p").html('');
$("div.error.step1_error").hide();
var totalDays=car_rentals.calculateDifferenceInDays(car_rentals.getSelectedDateFrom(), selectedDate);
window.bookingRequest.totalDays=totalDays;
car_rentals.selectDateTo(selectedTime, dateText);
car_rentals.buildRatesTable();
car_rentals.recalculateExtraItemTotals();
}}
},
onChangeMonthYear: function (year, month, inst){
window.currentMonth=month;
window.currentYear=year;
window.currentDay=1;
car_rentals.populateCarRentalBookedOutDates(window.carRentalId, window.currentMonth, window.currentYear, car_rentals.refreshDatePicker);
}});
}},
recalculateExtraItemTotals: function(){
if(Object.size(window.bookingRequest.extraItems) > 0){
if(window.bookingRequest.extraItemsTotalPrice > 0){
window.bookingRequest.totalPrice=window.bookingRequest.totalCarRentalOnlyPrice;
window.bookingRequest.extraItemsTotalPrice=0;
}
$.each(window.bookingRequest.extraItems, function(id, extraItem){
var extraItemPrice=extraItem.price;
if(extraItem.pricePerPerson){
extraItemPrice=(window.bookingRequest.people * extraItemPrice);
}
if(extraItem.pricePerDay){
extraItemPrice=extraItemPrice * window.bookingRequest.totalDays;
}
extraItem.summedPrice=extraItem.quantity * extraItemPrice;
window.bookingRequest.totalPrice +=extraItem.summedPrice;
window.bookingRequest.extraItemsTotalPrice +=extraItem.summedPrice;
});
$('.extra_items_total').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
$('.total_price').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
}},
buildExtraItemsTable:function(){
$('table.extra_items_price_breakdown thead').html('');
$('table.extra_items_price_breakdown tfoot').html('');
$('table.extra_items_price_breakdown tbody').html('');
var headerRow='';
headerRow +='';
headerRow +='' + window.itemLabel + ' | ';
headerRow +='' + window.priceLabel + ' | ';
headerRow +='
';
$('table.extra_items_price_breakdown thead').append(headerRow);
var footerRow='';
footerRow +='';
footerRow +='' + window.priceTotalLabel + ' | ';
footerRow +='';
footerRow +='
';
$('table.extra_items_price_breakdown tfoot').append(footerRow);
},
bindExtraItemsQuantitySelect: function(){
$('select.extra_item_quantity').unbind('change');
$('select.extra_item_quantity').on('change', function(e){
var quantity=parseInt($(this).val());
var extraItemId=$(this).attr('id').replace('extra_item_quantity_', '');
car_rentals.updateExtraItemSelection(extraItemId, quantity);
});
},
updateExtraItemSelection: function(extraItemId, quantity){
if(extraItemId > 0){
var extraItemPrice=parseFloat($('#extra_item_price_' + extraItemId).val());
var extraItemTitle=$('#extra_item_title_' + extraItemId).html();
var extraItemPricePerPerson=parseInt($('#extra_item_price_per_person_' + extraItemId).val());
var extraItemPricePerDay=parseInt($('#extra_item_price_per_day_' + extraItemId).val());
var oldExtraItem=null;
var extraItem={};
var extraItemRows='';
var pricingMethod='';
if(extraItemId in window.bookingRequest.extraItems){
oldExtraItem=window.bookingRequest.extraItems[extraItemId];
window.bookingRequest.totalPrice -=parseFloat(oldExtraItem.summedPrice);
window.bookingRequest.extraItemsTotalPrice -=parseFloat(oldExtraItem.summedPrice);
delete window.bookingRequest.extraItems[extraItemId];
}
$('table.extra_items_price_breakdown tbody').html('');
if(quantity > 0){
extraItem.quantity=quantity;
extraItem.id=extraItemId;
extraItem.price=extraItemPrice;
extraItem.pricePerPerson=extraItemPricePerPerson;
extraItem.pricePerDay=extraItemPricePerDay;
if(extraItem.pricePerPerson){
extraItemPrice=(window.bookingRequest.people * extraItemPrice);
}
if(extraItem.pricePerDay){
extraItemPrice=extraItemPrice * window.bookingRequest.totalDays;
}
extraItem.summedPrice=extraItem.quantity * extraItemPrice;
extraItem.title=extraItemTitle;
window.bookingRequest.totalPrice +=extraItem.summedPrice;
window.bookingRequest.extraItemsTotalPrice +=extraItem.summedPrice;
window.bookingRequest.extraItems[extraItemId]=extraItem;
}
if(Object.size(window.bookingRequest.extraItems) > 0){
$.each(window.bookingRequest.extraItems, function(index, value){
pricingMethod='';
if(value.pricePerDay&&value.pricePerPerson)
pricingMethod=window.pricedPerDayPerPersonLabel;
else if(value.pricePerDay)
pricingMethod=window.pricedPerDayLabel;
else if(value.pricePerPerson)
pricingMethod=window.pricedPerPersonLabel;
extraItemRows +='';
});
}
$('table.extra_items_price_breakdown tbody').html(extraItemRows);
$('.extra_items_total').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
$('.total_price').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$.uniform.update(".extra_item_quantity");
}},
populateCarRentalBookedOutDates:function (carRentalId, month, year, callDelegate){
window.carRentalBookedOutDays=[];
var dataObj={
'action':'car_rental_booked_dates_request',
'car_rental_id':carRentalId,
'month':month,
'year':year,
'nonce':BYTAjax.nonce
};
$.ajax({
url: BYTAjax.ajaxurl,
data: dataObj,
success:function(json){
var bookedDates=JSON.parse(json);
var i=0;
for (i=0; i < bookedDates.length; ++i){
window.carRentalBookedOutDays.push(bookedDates[i].booking_date);
}
if(typeof(callDelegate)!=='undefined'){
callDelegate();
}},
error: function(errorThrown){
}});
},
processBooking:function(){
if(typeof(window.bookingRequest)!=='undefined'){
$('#wait_loading').show();
var selectedDateFrom=new Date(window.bookingRequest.selectedTimeFrom);
var selectedDateTo=new Date(window.bookingRequest.selectedTimeTo);
var dateFrom=selectedDateFrom.getFullYear() + "-" + (selectedDateFrom.getMonth() + 1) + "-" + selectedDateFrom.getDate();
var dateTo=selectedDateTo.getFullYear() + "-" + (selectedDateTo.getMonth() + 1) + "-" + selectedDateTo.getDate();
var dropOff=$('#booking_form_drop_off option:selected').val();
var dropOffText=$('#booking_form_drop_off option:selected').text();
var cValS=$('#c_val_s_cr').val();
var cVal1=$('#c_val_1_cr').val();
var cVal2=$('#c_val_2_cr').val();
var dataObj={
'action':'car_rental_process_booking_ajax_request',
'user_id':window.currentUserId,
'car_rental_id':window.carRentalId,
'extra_items':window.bookingRequest.extraItems,
'people':window.bookingRequest.people,
'date_from':dateFrom,
'date_to':dateTo,
'drop_off':dropOff,
'c_val_s':cValS,
'c_val_1':cVal1,
'c_val_2':cVal2,
'nonce':BYTAjax.nonce
};
$.each(window.bookingFormFields, function(index, field){
if(field.hide!=='1'){
dataObj[field.id]=$('#' + field.id).val();
$('.confirm_' + field.id + '_p').html($('#' + field.id).val());
}});
$('.confirm_pick_up_p').html(window.carRentalPickUp);
$('.confirm_drop_off_p').html(dropOffText);
$('.confirm_car_rental_name_p').html(carRentalTitle);
$('.confirm_car_rental_type_p').html(carRentalTitle);
$('.confirm_date_from_p').html(window.bookingRequest.selectedDateFrom);
$('.confirm_date_to_p').html(window.bookingRequest.selectedDateTo);
if($('.confirm_reservation_total_p').length > 0){
$('.confirm_reservation_total_p').html(car_rentals.formatPrice(window.bookingRequest.totalCarRentalOnlyPrice));
}
if($('.confirm_extra_items_total_p').length > 0){
$('.confirm_extra_items_total_p').html(car_rentals.formatPrice(window.bookingRequest.extraItemsTotalPrice));
}
$('.confirm_total_price_p').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$.ajax({
url: BYTAjax.ajaxurl,
data: dataObj,
success:function(data){
if(data=='captcha_error'){
$("div.error div p").html(window.invalidCaptchaMessage);
$("div.error").show();
}else{
$("div.error div p").html('');
$("div.error").hide();
car_rentals.hideCarRentalBookingForm();
car_rentals.showCarRentalConfirmationForm();
}
$('#wait_loading').hide();
},
error: function(errorThrown){
console.log(errorThrown);
}});
}},
buildRatesTable: function(){
var people=window.bookingRequest.people;
var headerRow='';
var footerRow='';
var colCount=2;
var selectedTimeFrom=car_rentals.getSelectedTimeFrom();
var selectedTimeTo=car_rentals.getSelectedTimeTo();
$(".price_row").show();
$.uniform.update(".extra_item_quantity");
$('table.car_rental_price_breakdown thead').html('');
$('table.car_rental_price_breakdown tfoot').html('');
$('table.car_rental_price_breakdown tbody').html('');
headerRow +='';
headerRow +='' + window.dateLabel + ' | ';
headerRow +='' + window.pricePerDayLabel + ' | ';
headerRow +='
';
$('table.car_rental_price_breakdown thead').append(headerRow);
footerRow +='';
footerRow +='' + window.priceTotalLabel + ' | ';
footerRow +='' + car_rentals.formatPrice(0) + ' | ';
footerRow +='
';
$('table.car_rental_price_breakdown tfoot').append(footerRow);
if(selectedTimeFrom&&selectedTimeTo){
$('#datepicker_loading').show();
window.bookingRequest.totalPrice=0;
window.bookingRequest.totalCarRentalOnlyPrice=0;
window.rateTableRowIndex=0;
while (selectedTimeFrom < selectedTimeTo){
car_rentals.buildRateRow(selectedTimeFrom, people, colCount);
selectedTimeFrom +=86400000;
}
$('.reservation_total').html(car_rentals.formatPrice(window.bookingRequest.totalCarRentalOnlyPrice));
$('.total_price').html(car_rentals.formatPrice(window.bookingRequest.totalPrice));
$('.booking-commands .book-car_rental-next').show();
car_rentals.bindNextButton();
car_rentals.bindCancelButton();
$('#datepicker_loading').hide();
}},
buildRateRow:function(fromTime, people, colCount){
var fromDate=new Date(fromTime);
var tableRow='';
var pricePerDay=parseFloat(window.carRentalPrice);
var dateToCheck=(fromDate.getFullYear() + '-' + ("0" + (fromDate.getMonth() + 1)).slice(-2) + '-' + ("0" + fromDate.getDate()).slice(-2));
var bookedOutDayIndex=$.inArray(dateToCheck, window.carRentalBookedOutDays);
if(bookedOutDayIndex==-1){
window.rateTableRowIndex++;
tableRow +='';
tableRow +='' + $.datepicker.formatDate(window.datepickerDateFormat, fromDate) + ' | ';
window.bookingRequest.totalPrice +=pricePerDay;
window.bookingRequest.totalCarRentalOnlyPrice +=pricePerDay;
tableRow +='' + car_rentals.formatPrice(pricePerDay) + ' | ';
tableRow +='
';
$('table.car_rental_price_breakdown tbody').append(tableRow);
if(window.rateTableRowIndex==window.bookingRequest.totalDays){
if($("table.car_rental_price_breakdown").data('tablesorter')===null||typeof($("table.car_rental_price_breakdown").data('tablesorter'))=='undefined'){
$("table.car_rental_price_breakdown").tablesorter({
debug:false,
dateFormat: window.datepickerDateFormat, // 'ddmmyyyy',
sortList: [[0,0]]
});
}
$("table.car_rental_price_breakdown").trigger("update");
$("table.car_rental_price_breakdown").trigger("sorton", [[[0,0]]]);
$("table.responsive").trigger('updated');
}}
},
addProductToCart:function (){
var selectedDateFrom=new Date(car_rentals.getSelectedTimeFrom());
var selectedDateTo=new Date(car_rentals.getSelectedTimeTo());
var dateFrom=selectedDateFrom.getFullYear() + "-" + (selectedDateFrom.getMonth() + 1) + "-" + selectedDateFrom.getDate();
var dateTo=selectedDateTo.getFullYear() + "-" + (selectedDateTo.getMonth() + 1) + "-" + selectedDateTo.getDate();
var dropOff=$('#booking_form_drop_off option:selected').val();
window.bookingRequest.people=1;
var dataObj={
'action':'car_rental_booking_add_to_cart_ajax_request',
'user_id':window.currentUserId,
'car_rental_id':window.carRentalId,
'extra_items':window.bookingRequest.extraItems,
'date_from':dateFrom,
'date_to':dateTo,
'drop_off':dropOff,
'nonce':BYTAjax.nonce
};
$.each(window.bookingFormFields, function(index, field){
if(field.hide!=='1'){
dataObj[field.id]=$('#' + field.id).val();
}});
$.ajax({
url: BYTAjax.ajaxurl,
data: dataObj,
success:function(data){
car_rentals.redirectToCart();
},
error: function(errorThrown){
console.log(errorThrown);
}});
},
selectDateFrom:function(time, dateText){
window.bookingRequest.totalPrice=0;
window.bookingRequest.totalCarRentalOnlyPrice=0;
window.bookingRequest.totalDays=0;
window.bookingRequest.people=1;
window.bookingRequest.extraItemsTotalPrice=0;
window.bookingRequest.selectedTimeFrom=time;
window.bookingRequest.selectedDateFrom=dateText;
window.bookingRequest.selectedTimeTo=null;
window.bookingRequest.selectedDateTo=null;
$('.price_breakdown').hide();
$("#selected_date_from").val(time);
$("#selected_date_to").val(null);
$(".date_from_text").html(dateText);
$(".date_to_text").html(window.defaultDateToText);
$(".booking-commands").show();
$(".booking-commands .book-car_rental-reset").show();
$(".booking-commands .book-car_rental-next").hide();
$('.reservation_total').html(car_rentals.formatPrice(0));
$('.total_price').html(car_rentals.formatPrice(0));
$('.extra_items_total').html(car_rentals.formatPrice(0));
$(".dates_row").show();
$(".price_row").hide();
},
selectDateTo: function(time, dateText){
$('.price_breakdown').show();
$('table.car_rental_price_breakdown thead').html('');
$('table.car_rental_price_breakdown tbody').html('');
$('table.car_rental_price_breakdown tfoot').html('');
$(".date_to_text").html(dateText);
$("#selected_date_to").val(time);
car_rentals.bindRequiredExtraItems();
window.bookingRequest.selectedTimeTo=time;
window.bookingRequest.selectedDateTo=dateText;
},
getSelectedDateFrom: function (){
if($("#selected_date_from").val()){
return car_rentals.convertLocalToUTC(new Date(parseInt($("#selected_date_from").val())));
}
return null;
},
getSelectedDateTo: function (){
if($("#selected_date_to").val()){
return car_rentals.convertLocalToUTC(new Date(parseInt($("#selected_date_to").val())));
}
return null;
},
getSelectedTimeFrom: function (){
if($("#selected_date_from").val()){
return parseInt($("#selected_date_from").val());
}
return null;
},
getSelectedTimeTo: function (){
if($("#selected_date_to").val()){
return parseInt($("#selected_date_to").val());
}
return null;
},
refreshDatePicker:function(){
if(typeof $('.car_booking_form_datepicker')!=='undefined'){
$('.car_booking_form_datepicker').datepicker("refresh");
}
$('#wait_loading').hide();
},
redirectToCart:function(){
top.location.href=window.wooCartPageUri;
},
calculateDifferenceInDays:function(date1, date2){
return (Date.UTC(date2.getYear(), date2.getMonth(), date2.getDate()) - Date.UTC(date1.getYear(), date1.getMonth(), date1.getDate())) / 86400000;
},
daysInMonth:function(month, year){
return new Date(year, month, 0).getDate();
},
convertLocalToUTC:function (date){
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
},
formatPrice: function(price){
if(window.currencySymbolShowAfter)
return price.toFixed(window.priceDecimalPlaces) + ' ' + window.currencySymbol;
else
return window.currencySymbol + ' ' + price.toFixed(window.priceDecimalPlaces);
},
};})(jQuery);
(function($){
$(document).ready(function (){
inquiry.init();
});
var inquiry={
init: function (){
$('.contact-' + window.postType).on('click', function(event){
inquiry.showInquiryForm();
event.preventDefault();
});
$('.cancel-' + window.postType + '-inquiry').on('click', function(event){
inquiry.hideInquiryForm();
event.preventDefault();
});
$('.' + window.postType + '-inquiry-form').validate({
onkeyup: false,
ignore: [],
invalidHandler: function(e, validator){
var errors=validator.numberOfInvalids();
if(errors){
var message=errors==1 ? window.formSingleError:window.formMultipleError.format(errors);
$("div.error div p").html(message);
$("div.error").show();
}else{
$("div.error").hide();
}},
submitHandler: function(){ inquiry.processInquiry(); }});
$.each(window.inquiryFormFields, function(index, field){
if(field.hide!=='1'&&field.id!==null&&field.id.length > 0){
var $input=null;
if(field.type=='text'||field.type=='email'){
$input=$('.' + window.postType + '-inquiry-form').find('input[name=' + field.id + ']');
}else if(field.type=='textarea'){
$input=$('.' + window.postType + '-inquiry-form').find('textarea[name=' + field.id + ']');
}
if($input!==null&&typeof($input)!=='undefined'){
if(field.required=='1'){
$input.rules('add', {
required: true,
messages: {
required: window.inquiryFormRequiredError
}});
}
if(field.type=='email'){
$input.rules('add', {
email: true,
messages: {
required: window.inquiryFormEmailError
}});
}}
}});
},
showInquiryForm:function (){
$('.three-fourth').hide();
$('.right-sidebar').hide();
$('.full-width.' + window.postType + '-inquiry-section').show();
$('html, body').animate({
scrollTop: $('.full-width.' + window.postType + '-inquiry-section').offset().top
}, 1000);
},
hideInquiryForm:function (){
$('.three-fourth').show();
$('.right-sidebar').show();
$('.full-width.' + window.postType + '-inquiry-section').hide();
},
processInquiry:function (){
var cValS=$('#c_val_s_inq').val();
var cVal1=$('#c_val_1_inq').val();
var cVal2=$('#c_val_2_inq').val();
var dataObj={
'action':'inquiry_ajax_request',
'userId':window.currentUserId,
'postId':window.postId,
'c_val_s':cValS,
'c_val_1':cVal1,
'c_val_2':cVal2,
'nonce':BYTAjax.nonce
};
$.each(window.inquiryFormFields, function(index, field){
if(field.hide!=='1'){
dataObj[field.id]=$('#' + field.id).val();
}});
$.ajax({
url: BYTAjax.ajaxurl,
data: dataObj,
success:function(data){
if(data=='captcha_error'){
$("div.error div p").html(window.InvalidCaptchaMessage);
$("div.error").show();
}else{
$("div.error div p").html('');
$("div.error").hide();
$('.contact-' + window.postType).hide();
inquiry.hideInquiryForm();
$('.inquiry-form-thank-you').show();
}},
error: function(errorThrown){
}});
}};})(jQuery);
(function($){function Countdown(){this.regional=[];this.regional['']={labels:['Years','Months','Weeks','Days','Hours','Minutes','Seconds'],labels1:['Year','Month','Week','Day','Hour','Minute','Second'],compactLabels:['y','m','w','d'],whichLabels:null,timeSeparator:':',isRTL:false};this._defaults={until:null,since:null,timezone:null,serverSync:null,format:'dHMS',layout:'',compact:false,significant:0,description:'',expiryUrl:'',expiryText:'',alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1};$.extend(this._defaults,this.regional['']);this._serverSyncs=[]}var w='countdown';var Y=0;var O=1;var W=2;var D=3;var H=4;var M=5;var S=6;$.extend(Countdown.prototype,{markerClassName:'hasCountdown',_timer:setInterval(function(){$.countdown._updateTargets()},980),_timerTargets:[],setDefaults:function(a){this._resetExtraLabels(this._defaults,a);extendRemove(this._defaults,a||{})},UTCDate:function(a,b,c,e,f,g,h,i){if(typeof b=='object'&&b.constructor==Date){i=b.getMilliseconds();h=b.getSeconds();g=b.getMinutes();f=b.getHours();e=b.getDate();c=b.getMonth();b=b.getFullYear()}var d=new Date();d.setUTCFullYear(b);d.setUTCDate(1);d.setUTCMonth(c||0);d.setUTCDate(e||1);d.setUTCHours(f||0);d.setUTCMinutes((g||0)-(Math.abs(a)<30?a*60:a));d.setUTCSeconds(h||0);d.setUTCMilliseconds(i||0);return d},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_settingsCountdown:function(a,b){if(!b){return $.countdown._defaults}var c=$.data(a,w);return(b=='all'?c.options:c.options[b])},_attachCountdown:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName)){return}c.addClass(this.markerClassName);var d={options:$.extend({},b),_periods:[0,0,0,0,0,0,0]};$.data(a,w,d);this._changeCountdown(a)},_addTarget:function(a){if(!this._hasTarget(a)){this._timerTargets.push(a)}},_hasTarget:function(a){return($.inArray(a,this._timerTargets)>-1)},_removeTarget:function(b){this._timerTargets=$.map(this._timerTargets,function(a){return(a==b?null:a)})},_updateTargets:function(){for(var i=this._timerTargets.length-1;i>=0;i--){this._updateCountdown(this._timerTargets[i])}},_updateCountdown:function(a,b){var c=$(a);b=b||$.data(a,w);if(!b){return}c.html(this._generateHTML(b));c[(this._get(b,'isRTL')?'add':'remove')+'Class']('countdown_rtl');var d=this._get(b,'onTick');if(d){var e=b._hold!='lap'?b._periods:this._calculatePeriods(b,b._show,this._get(b,'significant'),new Date());var f=this._get(b,'tickInterval');if(f==1||this.periodsToSeconds(e)%f==0){d.apply(a,[e])}}var g=b._hold!='pause'&&(b._since?b._now.getTime()=b._until.getTime());if(g&&!b._expiring){b._expiring=true;if(this._hasTarget(a)||this._get(b,'alwaysExpire')){this._removeTarget(a);var h=this._get(b,'onExpiry');if(h){h.apply(a,[])}var i=this._get(b,'expiryText');if(i){var j=this._get(b,'layout');b.options.layout=i;this._updateCountdown(a,b);b.options.layout=j}var k=this._get(b,'expiryUrl');if(k){window.location=k}}b._expiring=false}else if(b._hold=='pause'){this._removeTarget(a)}$.data(a,w,b)},_changeCountdown:function(a,b,c){b=b||{};if(typeof b=='string'){var d=b;b={};b[d]=c}var e=$.data(a,w);if(e){this._resetExtraLabels(e.options,b);extendRemove(e.options,b);this._adjustSettings(a,e);$.data(a,w,e);var f=new Date();if((e._since&&e._sincef)){this._addTarget(a)}this._updateCountdown(a,e)}},_resetExtraLabels:function(a,b){var c=false;for(var n in b){if(n!='whichLabels'&&n.match(/[Ll]abels/)){c=true;break}}if(c){for(var n in a){if(n.match(/[Ll]abels[0-9]/)){a[n]=null}}}},_adjustSettings:function(a,b){var c;var d=this._get(b,'serverSync');var e=0;var f=null;for(var i=0;i0);h[i]=(c._show[i]=='?'&&!e?null:c._show[i]);f+=(h[i]?1:0);g-=(c._periods[i]>0?1:0)}var j=[false,false,false,false,false,false,false];for(var i=S;i>=Y;i--){if(c._show[i]){if(c._periods[i]){j[i]=true}else{j[i]=g>0;g--}}}var k=this._get(c,'compact');var l=this._get(c,'layout');var m=(k?this._get(c,'compactLabels'):this._get(c,'labels'));var n=this._get(c,'whichLabels')||this._normalLabels;var o=this._get(c,'timeSeparator');var p=this._get(c,'description')||'';var q=function(a){var b=$.countdown._get(c,'compactLabels'+n(c._periods[a]));return(h[a]?c._periods[a]+(b?b[a]:m[a])+' ':'')};var r=function(a){var b=$.countdown._get(c,'labels'+n(c._periods[a]));return((!d&&h[a])||(d&&j[a])?''+c._periods[a]+'
'+(b?b[a]:m[a])+'':'')};return(l?this._buildLayout(c,h,l,k,d,j):((k?''+q(Y)+q(O)+q(W)+q(D)+(h[H]?this._minDigits(c._periods[H],2):'')+(h[M]?(h[H]?o:'')+this._minDigits(c._periods[M],2):'')+(h[S]?(h[H]||h[M]?o:'')+this._minDigits(c._periods[S],2):''):''+r(Y)+r(O)+r(W)+r(D)+r(H)+r(M)+r(S))+''+(p?''+p+'':'')))},_buildLayout:function(c,d,e,f,g,h){var j=this._get(c,(f?'compactLabels':'labels'));var k=this._get(c,'whichLabels')||this._normalLabels;var l=function(a){return($.countdown._get(c,(f?'compactLabels':'labels')+k(c._periods[a]))||j)[a]};var m=function(a,b){return Math.floor(a/b)%10};var o={desc:this._get(c,'description'),sep:this._get(c,'timeSeparator'),yl:l(Y),yn:c._periods[Y],ynn:this._minDigits(c._periods[Y],2),ynnn:this._minDigits(c._periods[Y],3),y1:m(c._periods[Y],1),y10:m(c._periods[Y],10),y100:m(c._periods[Y],100),y1000:m(c._periods[Y],1000),ol:l(O),on:c._periods[O],onn:this._minDigits(c._periods[O],2),onnn:this._minDigits(c._periods[O],3),o1:m(c._periods[O],1),o10:m(c._periods[O],10),o100:m(c._periods[O],100),o1000:m(c._periods[O],1000),wl:l(W),wn:c._periods[W],wnn:this._minDigits(c._periods[W],2),wnnn:this._minDigits(c._periods[W],3),w1:m(c._periods[W],1),w10:m(c._periods[W],10),w100:m(c._periods[W],100),w1000:m(c._periods[W],1000),dl:l(D),dn:c._periods[D],dnn:this._minDigits(c._periods[D],2),dnnn:this._minDigits(c._periods[D],3),d1:m(c._periods[D],1),d10:m(c._periods[D],10),d100:m(c._periods[D],100),d1000:m(c._periods[D],1000),hl:l(H),hn:c._periods[H],hnn:this._minDigits(c._periods[H],2),hnnn:this._minDigits(c._periods[H],3),h1:m(c._periods[H],1),h10:m(c._periods[H],10),h100:m(c._periods[H],100),h1000:m(c._periods[H],1000),ml:l(M),mn:c._periods[M],mnn:this._minDigits(c._periods[M],2),mnnn:this._minDigits(c._periods[M],3),m1:m(c._periods[M],1),m10:m(c._periods[M],10),m100:m(c._periods[M],100),m1000:m(c._periods[M],1000),sl:l(S),sn:c._periods[S],snn:this._minDigits(c._periods[S],2),snnn:this._minDigits(c._periods[S],3),s1:m(c._periods[S],1),s10:m(c._periods[S],10),s100:m(c._periods[S],100),s1000:m(c._periods[S],1000)};var p=e;for(var i=Y;i<=S;i++){var q='yowdhms'.charAt(i);var r=new RegExp('\\{'+q+'<\\}(.*)\\{'+q+'>\\}','g');p=p.replace(r,((!g&&d[i])||(g&&h[i])?'$1':''))}$.each(o,function(n,v){var a=new RegExp('\\{'+n+'\\}','g');p=p.replace(a,v)});return p},_minDigits:function(a,b){a=''+a;if(a.length>=b){return a}a='0000000000'+a;return a.substr(a.length-b)},_determineShow:function(a){var b=this._get(a,'format');var c=[];c[Y]=(b.match('y')?'?':(b.match('Y')?'!':null));c[O]=(b.match('o')?'?':(b.match('O')?'!':null));c[W]=(b.match('w')?'?':(b.match('W')?'!':null));c[D]=(b.match('d')?'?':(b.match('D')?'!':null));c[H]=(b.match('h')?'?':(b.match('H')?'!':null));c[M]=(b.match('m')?'?':(b.match('M')?'!':null));c[S]=(b.match('s')?'?':(b.match('S')?'!':null));return c},_calculatePeriods:function(c,d,e,f){c._now=f;c._now.setMilliseconds(0);var g=new Date(c._now.getTime());if(c._since){if(f.getTime()c._until.getTime()){c._now=f=g}}var h=[0,0,0,0,0,0,0];if(d[Y]||d[O]){var i=$.countdown._getDaysInMonth(f.getFullYear(),f.getMonth());var j=$.countdown._getDaysInMonth(g.getFullYear(),g.getMonth());var k=(g.getDate()==f.getDate()||(g.getDate()>=Math.min(i,j)&&f.getDate()>=Math.min(i,j)));var l=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var m=Math.max(0,(g.getFullYear()-f.getFullYear())*12+g.getMonth()-f.getMonth()+((g.getDate()o){f.setDate(o)}f.setFullYear(f.getFullYear()+h[Y]);f.setMonth(f.getMonth()+h[O]);if(n){f.setDate(o)}}var p=Math.floor((g.getTime()-f.getTime())/1000);var q=function(a,b){h[a]=(d[a]?Math.floor(p/b):0);p-=h[a]*b};q(W,604800);q(D,86400);q(H,3600);q(M,60);q(S,1);if(p>0&&!c._since){var r=[1,12,4.3482,7,24,60,60];var s=S;var t=1;for(var u=S;u>=Y;u--){if(d[u]){if(h[s]>=t){h[s]=0;p=1}if(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}if(e){for(var u=Y;u<=S;u++){if(e&&h[u]){e--}else if(!e){h[u]=0}}}return h}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.countdown=function(a){var b=Array.prototype.slice.call(arguments,1);if(a=='getTimes'||a=='settings'){return $.countdown['_'+a+'Countdown'].apply($.countdown,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){$.countdown['_'+a+'Countdown'].apply($.countdown,[this].concat(b))}else{$.countdown._attachCountdown(this,a)}})};$.countdown=new Countdown()})(jQuery);
var epdofitvids=epdofitvids||function(a){a.fn.fitVidsEP=function(b){if(_EPYT_.epresponsiveselector.constructor!==Array){_EPYT_.epresponsiveselector=JSON.parse(_EPYT_.epresponsiveselector)}var c={customSelector:null};if(!document.getElementById("fit-vids-style")){var f=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],e="";f.className="fit-vids-style";f.id="fit-vids-style";f.style.display="none";f.innerHTML=e;d.parentNode.insertBefore(f,d)}if(b){a.extend(c,b)}return this.each(function(){var g=_EPYT_.epresponsiveselector;if(c.customSelector){g.push(c.customSelector)}var h=a(this).find(g.join(","));h=h.not("object object");h.each(function(){var n=a(this);if(this.tagName.toLowerCase()==="embed"&&n.parent("object").length||n.parent(".fluid-width-video-wrapper").length||n.css("position")==="absolute"){return}if(n.is("[data-origwidth]:not([width])")){n.attr("width",n.data("origwidth"))}if(n.is("[data-origheight]:not([height])")){n.attr("height",n.data("origheight"))}var q=(this.tagName.toLowerCase()==="object"||(n.attr("height")&&!isNaN(parseInt(n.attr("height"),10))))?parseInt(n.attr("height"),10):n.height(),k=!isNaN(parseInt(n.attr("width"),10))?parseInt(n.attr("width"),10):n.width(),p=q/k;if(!n.attr("id")){var i="fitvid"+Math.floor(Math.random()*999999);n.attr("id",i)}var o=n.attr("width");var j=n.attr("height");if(n.parent().hasClass("epyt-video-wrapper")){try{n.parent().addClass("fluid-width-video-wrapper").attr("style","padding-top: "+(p*100)+"% !important;");n.removeAttr("height").removeAttr("width");setTimeout(function(){if(parseInt(n.parent().css("padding-top"),10)>n.height()+20){n.parent().removeClass("fluid-width-video-wrapper").css("padding-top","");n.attr("width",o);n.attr("height",j)}},100)}catch(l){}}else{var m=document.createElement("div");m.className="fluid-width-video-wrapper";try{n.wrap(m).parent(".fluid-width-video-wrapper").attr("style","padding-top: "+(p*100)+"% !important;");n.removeAttr("height").removeAttr("width");setTimeout(function(){if(parseInt(n.parent().css("padding-top"),10)>n.height()+20){n.parent().removeClass("fluid-width-video-wrapper").css("padding-top","");n.attr("width",o);n.attr("height",j)}},100)}catch(l){}}})})};a(document).ready(function(){a("body").fitVidsEP();a(document).ajaxSuccess(function(c,d,b){if(d&&d.responseText&&d.responseText.indexOf("